Reputation: 14418
So I have the following code snippet
$ch = curl_init();
//Set the URL
curl_setopt($ch, CURLOPT_URL, $jURL);
//Enable curl response
curl_setopt(CURLOPT_RETURNTRANSFER, true);
//Enable POST data
curl_setopt($ch, CURLOPT_POST, true);
//Use the $pData array as the POST data
curl_setopt($ch, CURLOPT_POSTFIELDS, $jData);
$result = curl_exec($ch);
echo 'The body of the response is ' . $result;
curl_close($ch);
I would like to get the response body printed out, however my code above prints the number 1. Is there a way to get the response here?
Upvotes: 0
Views: 12585
Reputation: 1216
You are missing the first argument:
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
Upvotes: 8