// access URL and request method $url = 'https://api.idxbroker.com/component/method/primary request ID/secondary request ID?query string' Example: 'https://api.idxbroker.com/clients/savedlinks/1' $method = (GET|PUT|POST|DELETE); if ($method == 'PUT' || $method == 'POST') { $data = array(fields to insert/update) Example: $data = array( 'linkName' => 'Good_side_of_tracks', // the link's url 'queryString' => array('idxID' => 'a001', 'hp' => 200000) ); $data = http_build_query($data); // encode and & delineate } // headers (required and optional) $headers = array( 'Content-Type: application/x-www-form-urlencoded', // required 'accesskey: Xz8puV@-ozDX-a1BHB2XsM', // required - replace with your own 'outputtype: json' // optional - overrides the preferences in our API control page ); // set up cURL $handle = curl_init(); curl_setopt($handle, CURLOPT_URL, $url); curl_setopt($handle, CURLOPT_HTTPHEADER, $headers); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); if ($method != 'GET') { curl_setopt($handle, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); } // exec the cURL request and returned information. Store the returned HTTP code in $code for later reference $response = curl_exec($handle); $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); if ($code >= 200 || $code < 300) { $response = json_decode($response,true); } else { $error = $code; }