所以我有以下代码片段
$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);
我想打开响应正文,但上面的代码打印出数字1.有没有办法在这里得到回复?
答案 0 :(得分:8)
您缺少第一个参数:
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);