我有一个php脚本,可以向url发送请求。但结果是空的。
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_ENCODING , "gzip, deflate");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp',
'Connection: Keep-Alive',
'User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36'
));
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'Format'=>'image/png',
'width'=>'550',
'height'=>'250',
));
$reuslt = curl_exec($ch);
$error_no = curl_errno($ch);
curl_close($ch);
我写echo $reuslt;
但这会产生如下错误:注意:未定义的变量:结果
我写echo $error;
这写了结果0
此查询结果应该将png图像返回给我的浏览器,但不会撤回任何内容。
答案 0 :(得分:1)
应该是$result
到处都不是$reuslt
(或者其他方面,但没有混合)