2011-09-11 72 views
0

所以我下面的代碼片段越來越HTTP POST響應體捲曲

$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.是否有一種方式來獲得這裏的迴應?

回答

8

你缺少第一個參數:

curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);