commands[0]->cx; $cm = $mydataObject->commands[0]->cm; // ********** SECOND COMMAND, requires that user is logged in //Preparing the get_bins command, which require user to be logged in //see https://www.pond5.com/index.php?page=api_ref_doc#get_bins for more info on the arguments $login_cmd= array(); $login_cmd['command'] = 'get_bins'; //Creating the json object with all data $json_object = array(); $json_object["api_key"] = $apiKey; $json_object["ver"] = 1; $json_object["commands_json"] = json_encode( array($login_cmd) ); //NOTE: the commands_hash must always have the string 'dragspel' appended $json_object["commands_hash"] = md5($json_object["commands_json"] . $apiSecret . 'dragspel'); $data_req = json_encode($json_object); //the post argument $post_val = "api=" . urlencode($data_req); //NOTE: here we are adding the cx / cm values, so the api can recognize the loggedin user $post_val .= '&apicx=' . $cx; $post_val .= '&apicm=' . $cm; //perform the url request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$post_val); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $mydata = curl_exec ($ch); if (curl_errno($ch)) { echo "curl error [" . curl_error($ch) . "]\n"; exit; } else { curl_close($ch); } //lets have a look at the result echo "***** result from get_bins command ***** \n"; var_dump($mydata); ?>