Welcome to WebmasterWorld Guest from 54.145.166.247

Forum Moderators: buckworks

Message Too Old, No Replies

Nochex APC return problems

Anyone who knows how to use Nochex APC payment proccess?

   
8:36 pm on Jan 19, 2008 (gmt 0)

5+ Year Member



foreach ($_POST as $k=>$v) $p[]="$k=$v";
$fields=implode("&",$p);

$ch = curl_init("https://www.nochex.com/nochex.dll/apc/testapc");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 4); // times out after 4s
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // add POST fields and send to NOCHEX APC to match again
curl_setopt($ch, CURLOPT_REFERER, "http://www.domain.com/nochex.php");
$result = curl_exec($ch); // run the whole process

Dont why the return variable of $result could not get the word for "AUTHORISED" or "DECLINED", it is returning whole HTML for this [nochex.com...]

Actually, I want to get its return words, so that i can do it with matching in condition like e.g if ($result == "AUTHORISED") then take action.

Any expert who have this experiences, please...

Many thanks!

8:16 am on Jan 20, 2008 (gmt 0)

5+ Year Member



No one know this? :( ....
10:08 am on Jan 20, 2008 (gmt 0)

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member



junkiet,

Have you tried the Nochex website? Maybe their API docs have some info? I assume your server does support CURL?

dc

3:55 pm on Jan 20, 2008 (gmt 0)

5+ Year Member



I found from other site, i try for this it is "Decline"

foreach ($_POST as $k=>$v) $p[]="$k=$v";
$fields=implode("&",$p);

$fields = ltrim ($fields, "&");
$header = "POST /nochex.dll/apc/apc HTTP/1.0\r\n";
$header.= "Content-Type: application/x-www-form-urlencoded\r\n";
$header.= "Content-Length: ".strlen($fields)."\r\n\r\n";
$fp = fsockopen ("ssl://www.nochex.com", 443, $errno, $errstr, 10);
if ($fp) {
fputs ($fp, $header.$fields);
while (!feof ($fp))
{
$response = fgets ($fp, 1024); // reponse a single word "AUTHORISED" or "DECLINED"
}
}
fclose($fp);

That $response will be assigned by string for "AUTHORISED" or "DECLINED"

5:24 am on Jan 21, 2008 (gmt 0)

5+ Year Member



Nevermind, i try again :)
5:27 am on Jan 22, 2008 (gmt 0)

5+ Year Member



foreach ($_POST as $k=>$v) $p[]="$k=$v";
$fields=implode("&",$p);

$ch = curl_init("https://www.nochex.com/nochex.dll/apc/apc");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 4); // times out after 4s
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // add POST fields and send to NOCHEX APC to match again
curl_setopt($ch, CURLOPT_REFERER, "http://www.domain.com/nochex.php");
$result = curl_exec($ch); // run the whole process

I found it, i can get the $result word for "AUTHORIZED" OR "DECLINE" :)