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

curl-and-php

php and libcurl question

From: Simon Orsborn <simon_at_ultramedia.com.au>
Date: Sun, 19 Sep 2004 08:31:23 +1000

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