Try to getting price list with below code but didn't get it.
$auth_url = "https://technet.rapaport.com/HTTP/Authenticate.aspx"; $post_string = "username=106872&password=" . urlencode("Hetupriy999"); //create HTTP POST request with curl: $request = curl_init($auth_url); // initiate curl object curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. $auth_ticket = curl_exec($request); // execute curl post and store results in $auth_ticket echo "<pre>"; print_r($auth_ticket); echo "</pre>"; curl_close ($request); //2 - prepare HTTP request for data. $feed_url = "https://technet.rapaport.com/HTTP/JSON/Prices/GetPriceSheet.aspx"; // $feed_url .= "?ticket=".$auth_ticket; //add authentication ticket: $ch = curl_init( $url ); # Setup request to send json via POST. // $payload = json_encode( array( "Ticket"=> $auth_ticket, "shape"=> 'round' ) ); $payload = json_encode( array( "shape"=> 'round' ) ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json','Ticket' => $auth_ticket)); # Return response instead of printing. curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); # Send request. $result = curl_exec($ch); curl_close($ch); // Will dump a beauty json :3 echo "<pre>"; print_r(json_decode($result, true)); echo "</pre>"; exit();
|