坏网址永远不会结束请求curl php

时间:2018-05-20 23:02:47

标签: php curl header

我的卷曲设置如下:

function file_get_contents_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$data = curl_exec($ch);
return $data;
}

当我用以下内容打电话时:

$html = file_get_contents_curl("https://training.sap.com/service-id/module.php/core/as_login.php?AuthId=sf-sp&ReturnTo=%2Fsuccessfactors-community%2Fpermission-check");

您可以看到该链接具有身份验证,我不想花时间在其上。我只是希望卷曲会话在3秒或x秒之后死亡,或者如果由于某种原因(例如SSL或密码要求等)它将成为卷曲上永无止境的循环,则需要先确定。

0 个答案:

没有答案
相关问题