curl - I am working on somebody else code to make users and cources in moodle using drupal -


can body tell me happening in code not able understand it?it function in cource name acquired using json , curl.please if 1 can help?

   function check_cat($name, $parent)     {     $token = variable_get('userop_webservice_token');      $domainname = variable_get('userop_webservice_domain');     $criterion = new stdclass(); $functionname = 'core_course_get_categories'; $restformat = 'json'; dpm($token); $criterion->key= 'name'; $criterion->value= $name;  $criter = array($criterion); $params = array('criteria' => $criter, 'addsubcategories'=>1);  /// rest call //header('content-type: text/plain');       $serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken='     . $token . '&wsfunction='.$functionname;     require_once('curl.inc');     $curl = new curl;           $restformat = ($restformat == 'json')?'&moodlewsrestformat=' .                      $restformat:'';         $resp = $curl->post($serverurl . $restformat, $params);         //print_r($resp);         $obj = json_decode($resp);       if (count($obj)<=0)         {       return  0;        }           else          {          foreach($obj $ob)           {         if($ob->parent==$parent)         return $ob->id;        }        return  0;        }         } 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -