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

curl-and-php

Curl error 7 while accessing a subdomain

From: Rakhy Sunny <rakhysunny_at_hotmail.com>
Date: Fri, 14 Nov 2008 18:36:37 +0000

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=XML URL 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

_________________________________________________________________
Movies, sports & news! Get your daily entertainment fix, only on live.com
http://www.live.com/?scope=video&form=MICOAL

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