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

php – cURL请求中的错误:名称查找超时

发布时间:2020-12-13 13:38:45 所属栏目:PHP教程 来源:网络整理
导读:我写了一些填写登录表单的代码,并通过post方式提交.喜欢: $config = array( 'adapter' = 'Zend_Http_Client_Adapter_Curl',); $this-siteObj = new Zend_Http_Client('http://example.com',$config); $this-siteObj-setCookieJar(); $this-siteObj-setUri('
我写了一些填写登录表单的代码,并通过post方式提交.喜欢:
$config = array(
        'adapter' => 'Zend_Http_Client_Adapter_Curl',);      

    $this->siteObj = new Zend_Http_Client('http://example.com',$config);
    $this->siteObj->setCookieJar();
    $this->siteObj->setUri('http://example.com/login');
    $this->siteObj->setParameterPost( 'data[User][name]','user' );
    $this->siteObj->setParameterPost( 'data[User][password]','password' );
    $response = $this->siteObj->request('POST');

它的工作很好,但有些时候这个错误发生:

Error in cURL request: name lookup timed out

Error: An Internal Error Has Occurred.

有什么问题?我该怎么办才能解决呢?

我遇到同样的问题:

从外壳,卷曲工作.
>从shell,PHP脚本工作.
> PHP无法ping网站.
> DNS配置是对的.

重新启动Apache后,它工作.这么奇怪.

(编辑:李大同)

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

    推荐文章
      热点阅读