加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

在CURL和PHP Geocoder中,连接在10000毫秒后超时

发布时间:2020-12-14 00:31:27 所属栏目:Linux 来源:网络整理
导读:我有一个循环脚本,我在其中执行 PHP地理编码器功能. 循环有超过1000次迭代,整个过程需要一些时间. 这是我的脚本: for ($x = 0; $x 1000; $x++) { ////////////////////////////////////////////////////// GECODE THE ADRESS AND GET THE COORDS$curl = new
我有一个循环脚本,我在其中执行 PHP地理编码器功能.
循环有超过1000次迭代,整个过程需要一些时间.
这是我的脚本:

for ($x = 0; $x < 1000; $x++) { 

////////////////////////////////////////////////////
// GECODE THE ADRESS AND GET THE COORDS
$curl     = new IvoryHttpAdapterCurlHttpAdapter();

$geocoder = new GeocoderProviderBingMaps($curl,$bingApikey);
//$geocoder = new GeocoderProviderMapQuest($curl,$mapQuestApikey);
//$geocoder = new GeocoderProviderArcGISOnline($curl);
//$geocoder = new GeocoderProviderOpenStreetMap($curl);


$result =  $geocoder->geocode($matchesAdressRightValues[$x][0]);

if (count($result)==0 || count($result)>1 ){
    $bingSucUn = 'not_success'; 
    array_push($arraySucUnsucBing,$bingSucUn);
}   
else {
    //echo ('result');
    //echo (count($result));
    //echo ('Endresult');
    $bingSucUn = 'success'; 
    array_push($arraySucUnsucBing,$bingSucUn);
}
//var_dump($result);
////////////////////////////////////////////////////
}  // end for

问题是我收到一个错误:

(&quot;Connection timed out after 10000 milliseconds&quot;).

我怎样才能增加限额?
我在屏幕上添加了这个,但它仅用于PHP而不是curl请求:

set_time_limit(0);

通常,如果我使用的是纯CURL而没有集成在PHP Geocoder中,那么我会做类似的事情:

$ch = curl_init();
curl_setopt($ch,CURLOPT_TIMEOUT,1000);

但是我现在该怎么办?

解决方法

我有类似的错误,这是由于代理设置.我已将我的代理设置为:

Sys.setenv(https_proxy="http://proxy:8000")

后来我才下载了.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读