我正在使用PHP curl方法获取字符串类型响应。要创建我使用的请求:使用curl获取URL响应的值
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, $data);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if($response === false)
throw new Exception(__CLASS__."::".__FUNCTION__."_".$err);
return $response;
为什么我总是收到一个bool(true)响应,而不是从另一端回显的字符串?
感谢
你说的 ' “真正的” 响应' 呢? $是字符串“真”还是布尔真? – GZipp 2010-01-04 20:41:59