homepage Welcome to WebmasterWorld Guest from 54.166.122.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Ecommerce
Forum Library, Charter, Moderators: buckworks

Ecommerce Forum

    
Nochex APC return problems
Anyone who knows how to use Nochex APC payment proccess?
junkiet

5+ Year Member



 
Msg#: 3552640 posted 8:36 pm on Jan 19, 2008 (gmt 0)

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 https://www.nochex.com/nochex.dll/apc/testapc

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!

 

junkiet

5+ Year Member



 
Msg#: 3552640 posted 8:16 am on Jan 20, 2008 (gmt 0)

No one know this? :( ....

dreamcatcher

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



 
Msg#: 3552640 posted 10:08 am on Jan 20, 2008 (gmt 0)

junkiet,

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

dc

junkiet

5+ Year Member



 
Msg#: 3552640 posted 3:55 pm on Jan 20, 2008 (gmt 0)

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"

junkiet

5+ Year Member



 
Msg#: 3552640 posted 5:24 am on Jan 21, 2008 (gmt 0)

Nevermind, i try again :)

junkiet

5+ Year Member



 
Msg#: 3552640 posted 5:27 am on Jan 22, 2008 (gmt 0)

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" :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Ecommerce
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved