0

因此,我一直在尝试从网站 API theTVDB.com 获取数据,并且在我的本地主机上一切正常。但是当我尝试从我的托管网站获取 XML 文件时,CloudFlare 声称我的 Web 服务器感染了病毒并提示输入验证码。唯一的问题是,它是一个 curl 请求,所以我无法输入验证码,它基本上什么都不返回。知道如何暂停 php 脚本以便我可以输入验证码或阻止它发生吗?我在测试中使用的特定 URL 是http://thetvdb.com/api//GetSeries.php?seriesname=New%20Girl,它在我测试它的任何计算机上都可以正常工作,除了我的服务器(小 nimvbus 托管)下面是我的 curl代码。(我正在打印的响应是我如何知道正在请求验证码)

    protected static function fetchData($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, "");
$response = curl_exec($ch);
print_r($response);
$httpCode = curl_getinfo($ch ,CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($ch,CURLINFO_HEADER_SIZE);
$data = substr( $response, $headerSize );
curl_close($ch);
if($httpCode != 200) {
return false;
}
return $data;
}
4

1 回答 1

1

Have you already actually contacted our support team? They'd be who you need to speak with directly. You'll need to white list (mark as trusted) the IP you're making this connection from to ensure you don't receive the challenge security page when trying to access the site.

p.s. I do work for CloudFlare.

于 2013-10-16T20:40:14.317 回答