cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: curl error 6 Couldn't resolve host in PHP

From: haroon ahmad <haroon_at_fastcreators.com>
Date: Tue, 4 Nov 2008 00:30:11 +0500

I think it will be very helpful for many, if you could post what version of
Apache and PHP-cURL you were using when you were getting the problem and
what versions you are using now when it is working?

Haroon Ahmad
www.haroonahmad.co.uk

On Tue, Nov 4, 2008 at 12:25 AM, Adam Stelmack <adam_at_phidgets.com> wrote:

> Hi,
>
> tried one more time updating to a different version of curl when I
> installed new version of openBSD on my machine and everything is running
> smoothly now. Thanks for the help.
>
> Adam Stelmack
> Developer and Webmaster
> Phidgets Inc.
> www.phidgets.com
>
>
>
> haroon ahmad wrote:
>
>> try this with $url only
>>
>> if(fopen($url,"r")) {
>> echo "opened"
>> }
>> else {
>> echo "problem";
>> }
>>
>> give me the output.
>>
>> On Fri, Oct 31, 2008 at 11:36 PM, Adam Stelmack <adam_at_phidgets.com<mailto:
>> adam_at_phidgets.com>> wrote:
>>
>> Hi,
>>
>> Have been trying to get curl working on our new server and
>> redesigned site. Server is openBSD4.3, php and curl installed
>> from packages. PHP version 5.2.5, curl version libcurl/7.17.1
>> OpenSSL/0.9.7j zlib/1.2.3 libidn/1.1.
>>
>> Trying to connect to a credit card processing company's testbed
>> environment, however curl seems to never be able to resolve the
>> hostname when run through PHP. I have been able to telnet and
>> ping the hostname and it has resolved without issue. Was even
>> able to resolve and connect when I just ran curl on the command
>> line just fine. The problem only seems to be when trying to use
>> the PHP curl implementation. Have been searching on google and a
>> little bit on the archives for possible solutions and come up
>> empty. All solutions I have found degraded to "it's your hosting
>> company, their DNS is broken" however, this is an internal server
>> and the only thing having trouble resolving dns is this webserver
>> and ONLY when trying to use curl in PHP.
>>
>> Code is as follows, pretty straightforward (leaving out url for
>> security reasons, but url is properly formed, I have tested it):
>>
>> $ch = curl_init();
>> curl_setopt($ch, CURLOPT_URL,$url);
>> curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
>> curl_setopt($ch, CURLOPT_VERBOSE, 1);
>> curl_setopt ($ch, CURLOPT_HEADER, 0);
>> curl_setopt($ch, CURLOPT_POST, 1);
>> curl_setopt($ch, CURLOPT_POSTFIELDS,$dataToSend);
>> curl_setopt($ch,CURLOPT_TIMEOUT,$gArray['CLIENT_TIMEOUT']);
>> curl_setopt($ch,CURLOPT_USERAGENT,$gArray['API_VERSION']);
>> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
>> curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
>>
>> $response=curl_exec ($ch);
>>
>> I doubt seeing the code will help, but thought I would be
>> thorough. Has anyone ever come across this issue and perhaps
>> managed to stumble across a solution? It's rather irritating as
>> our current live site works fine, but the versions and install
>> conditions I am sure are totally different and hard to replicate
>> at this point.
>> Thanks in advance for any replies!
>>
>> -- Adam Stelmack
>> Developer and Webmaster
>> Phidgets Inc.
>> www.phidgets.com <http://www.phidgets.com>
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-11-03