Error in cURL request: name lookup timed out

curl, dns, php, zend-framework, zend-http-client

Solution

I encountered the same problem:

- From the shell, curl worked.

- From the shell, the PHP script worked.

- PHP could not ping the website.

- The DNS config was right.

After restarting Apache, it worked. So strange.

Problem

I wrote some code that fill a login form and submit it via post method. Like: ``` $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?

Original source