Hi and PLEASE help.
I've read and tried to replicate the POST mimicking code shown on PHPnet (see below);
I can make my credit card authorization server work by GETting with the following URL.
https://secure.somexxsite.net/gateway/transact.dll?x_Version=3.1&x_Delim_Data=True&x_Login=xxxxxxxxx&
x_Tran_Key=yyyyyyyyyyyyy&adnumber=1001442&
x_Amount=28.50&x_Card_Num=9999999999999999&
x_Exp_Date=1003&
x_Type=AUTH_CAPTURE&x_Test_Request=TRUE
(I added manual linebreaks for easier reading.)
GETting with the URL I create works just fine. BUT...
All the values I've stuffed into the URL for GETting OUGHT to be POSTed, according to the authorization server. (I assume because the values in the URL above can be sniffed?)
I can see how the code snippet below is supposed to work. But it doesn't appear to support opening a https: type connection, which is what I need.
If anyone can steer me, I'd very much appreciate it.
Thanks,
Nemo
Here's the code from php.net:
foreach ($HTTP_POST_VARS as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
//create headers...
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= 'Content-Length: ' . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
if (!$fp) {
// ERROR
echo "$errstr ($errno)";
} else {
//put the data..
fputs ($fp, $header . $req);
while (!feof($fp)) {
//read the data returned...
$res = fgets ($fp, 1024);
}
fclose ($fp);
}