curl-and-php
Re: Curl error 7 while accessing a subdomain
Date: Sat, 15 Nov 2008 00:42:20 +0500
add curl_setopt($ch, CURLOPT_VERIFYHOST, FALSE);
to see if it works as that is one it is missing for ssl curl retrieval
2008/11/14 Rakhy Sunny <rakhysunny_at_hotmail.com>
> Hi,
>
> I am getting the curl error "CURL error #7: couldn't connect to host" when
> i am trying to access a subdomain URL with SSL.
>
> My cURL and SSL version goes like follows = "libcurl/7.16.0 OpenSSL/0.9.8g
> zlib/1.2.3".
>
> My situation on using cURL is like follows. I have a website which is
> running in SSL. Consider my site URL is https://www.mysite.com. Now there
> is an application running in the same machine which is accessible using a
> web URL and the URL for accessing that site is
> https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML.
> In a page of https://www.mysite.com/payment.php i am accessing the
> https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XMLURL using cURL and it gives me a "CURL error #7: couldn't connect to host"
> error. I am supposed to get an XML response for thsi URL.
>
> The URL
> https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML,
> if i copy paste in the browser will show me the correct XML response. But
> when accessing via php page with cURL it gives me this error.
>
> There is no port involved except one for SSL which is 443 and it is made
> accessible via the firewall.
>
> The code snipet used for this is as follows:
>
> <?php
> $cookies_file = "cookie_test.txt";
> $url = "
> https://www.mysite.com/payment/FEServlet?NameXsl=default&getDynamicString=XML
> ";
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_TIMEOUT,20);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies_file);
> $changePass_data = curl_exec($ch);
> if (curl_error($ch)){
> print "CURL error #" . curl_errno($ch) . ": " . curl_error($ch);
> }
> ?>
>
>
> What might be the work around for this issue or a possible solution?
>
> Thanks
> Rakhy
>
>
> ------------------------------
> Give the world a slice of your life. Get a Live.in id Check it out!<https://signup.live.com/signup.aspx?mkt=en-in&rollrs=12&lic=1>
>
> _______________________________________________
> 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-14