cURL請求出錯:名稱查找超時 - Error in cURL request: name lookup timed out -开发者知识库

cURL請求出錯:名稱查找超時 - Error in cURL request: name lookup timed out -开发者知识库,第1张

I wrote some code that fill a login form and submit it via post method. Like:

我寫了一些填寫登錄表單的代碼,並通過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');

its works fine, but some times this error occur:

它工作正常,但有時會發生此錯誤:

Error in cURL request: name lookup timed out

Error: An Internal Error Has Occurred.

whats the problem? what can I do to solve it?

有什么問題?我能做些什么來解決它?

3 个解决方案

#1


11  

I encountered the same problem:

我遇到了同樣的問題:

  • From the shell, curl worked.
  • 從外殼,卷曲工作。

  • From the shell, the PHP script worked.
  • 從shell開始,PHP腳本起作用了。

  • PHP could not ping the website.
  • PHP無法ping通網站。

  • The DNS config was right.
  • DNS配置是對的。

After restarting Apache, it worked. So strange.

重新啟動Apache后,它工作正常。這么奇怪。

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复