problem with cURL with https

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
wasimasif
Forum Newbie
Posts: 6
Joined: Mon Jan 26, 2004 2:58 am

problem with cURL with https

Post by wasimasif »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello All,

Code: Select all

<?
   $_url = 'https://www.yachting-casino.com/';
   $_VAR001 = 'nono';
   $_VAR002 = 'nonono';

   $params = "VAR001=$_VAR001&VAR002=$_VAR002&";
   $ch = curl_init();

   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,0);
   curl_setopt($ch, CURLOPT_POST,1);
   curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
   curl_setopt($ch, CURLOPT_URL,$_url);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,  FALSE);
   curl_setopt($ch, CURLOPT_USERAGENT,  "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
   $result=curl_exec ($ch);
   curl_close ($ch);
   echo("Output: ".$result);
?>
The problem is that this code is working on my testing server but its not working on my production server. Both servers are unix based.
On production server only ports 80 and 443 are open all other ports are blocked.
This works if i try to open http page but dosenot work if i try oppening https error code 7 error number 110 is returned.

I don't know which ports it uses, it will be grate if someone can tell me which ports i will need to open.

Thanks


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Re: problem with cURL with https

Post by Buddha443556 »

wasimasif wrote:I don't know which ports it uses, it will be grate if someone can tell me which ports i will need to open.
I believe it normally to be a random port however you might check out CURLOPT_LOCALPORT (and CURLOPT_LOCALPORTRANGE). Then just unblock the needed ports.
wasimasif
Forum Newbie
Posts: 6
Joined: Mon Jan 26, 2004 2:58 am

Post by wasimasif »

hmm thanks for the help i will check this .
wasimasif
Forum Newbie
Posts: 6
Joined: Mon Jan 26, 2004 2:58 am

Post by wasimasif »

:cry:
Tried CURLOPT_LOCALPORT on page and got this error can anyone tell whats the reason and solution

Notice: Use of undefined constant CURLOPT_LOCALPORT - assumed 'CURLOPT_LOCALPORT'
wasimasif
Forum Newbie
Posts: 6
Joined: Mon Jan 26, 2004 2:58 am

Post by wasimasif »

OK i got it its due to old version I am using
libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.1.4

and this was added in 7.12 :(

Still looking for any solution.
wasimasif
Forum Newbie
Posts: 6
Joined: Mon Jan 26, 2004 2:58 am

Post by wasimasif »

Hello All,

i got the issue resolved, we had to use PROXY to communicate with other https server.

see

Code: Select all

<?
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt ($ch, CURLOPT_PROXY, 'your proxy server IP:port');
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
?>
I hope this will help any one else
Post Reply