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

curl-and-php

Re: php and libcurl question

From: Pushpendra Tiwari <pushpendratiwari_at_hotpop.com>
Date: Sun, 19 Sep 2004 13:44:23 +0530

Hello to Every One...!

I'll suggest to print this...

echo curl_errno($ch);

Search the error and find the resaon....You will get the proper resoan...why response is not coming...! I was also facing the same problem but I got the solution..! And the error was SSL Certifiacte Probelm..!

So if you face the SSL problem then download SSL Certi from Curl website and add the phisical path of your SSL, after the curl_int();
and When you are working in https flow and your are reaching your curl page via https:// the you need not to write ths SSL Path because it's all ready passed..!

Hope things will work for you....!

Happy Programming...!

Pushp.

  ----- Original Message -----
  From: Simon Orsborn
  To: curl-and-php_at_cool.haxx.se
  Sent: Sunday, September 19, 2004 4:01 AM
  Subject: php and libcurl question

  Hi Everyone,

  I have a question about connecting to a perl based payment gateway from libcurl in PHP.

  I've been given a url to the perl script, and an outline of which post variables it expects to receive, but when I try to connect I get no response from the gateway. The wierd thing is, if I copy and paste the exact same url (with get variables) into the address bar of my browser I get a response. So I thought, my php must be wrong and not sending a request. So I changed the url in the curl code from the payment gateways perl script to the payment gateways public website, and lo and behold I get a response from their server.

  So as far as I can tell, their server is choosing to respond to the request my code makes, but their perl script is choosing not to.

  Here is the code - obviously with relevant account id info replaced. Notice the commented out line that sends the request to their website instead of their gateway script. This gets a response when I use it, but the url to the perl script does not.

  $ch = curl_init();

  curl_setopt($ch,CURLOPT_URL,"https://4tknox.au.com/cgi-bin/themerchant.au.com/ecom/external2.pl?LOGIN=123/abcdefghijklmnop&AMOUNT=1231&CCNUM=4111111111111111&CCEXP=12/34&COMMENT=24");
  //curl_setopt($ch,CURLOPT_URL,"https://www.netregistry.com?LOGIN=123/abcdefghijklmnop&AMOUNT=1231&CCNUM=4111111111111111&CCEXP=12/34&COMMENT=24");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

  $result=curl_exec ($ch);
  curl_close ($ch);
  print $result;

  Can anyone tell me if there is something screwy with my code? The gateway providers official position is 'We have many people who connect to netregistry from PHP with no problems (but they can't say who or how). The mongrels also told my client that it would only take two hours to set up the connection to the gateway, and if it took any longer it was because of my skill level. They offered to have their devleopers work on it for AU$66 per hour, but after much hassling about how long that would take finally admitted that none of their technical people actually knew how to program in PHP anyway...

  Thanks heaps :o)
  Simon O
Received on 2004-09-19