我无法显示curl的输出。我使用phpstorm与Xampp和echo剂量不起作用。在浏览器输出
502错误的网关
<?php
$execution_time_limit = 25000;
set_time_limit($execution_time_limit);
header('Content-type: text/html; charset=utf-8');
$url="https://stackoverflow.com/questions/ask";
$data = getPage($url);
echo $data;
function getPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 5555500);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
首先得到:
C:xampp
这样做:
- 只需以管理员身份运行“xampp-control.exe”即可
- 并停止apache服务操作端口。
- 并勾选此(在快照中)复选框,它将要求安装为服务只需安装它
- 然后单击开始
将XAMPP与IDE集成: