Using cURL to POST to a Payment Gateway and get back results
| From: | Matt Babineau | Date: | Wed, 09 Apr 2003 15:54:42 +0000 |
| Subject: | Using cURL to POST to a Payment Gateway and get back results | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19375@lists.php.net to get a copy of this message | ||
Hi All-
Here is my problem. I am posting to a payment gateway using cURL, and
pulling back the results. unfortunately, the results are in HTML!!!
I have used preg_match_all to get all the <INPUT> tags in the HTML
preg_match_all('/<INPUT(.*?)>/s',$result,$out);
for ($i=0; $i< count($out[1]); $i++) {
echo $out[1][$i]."<BR>";
}
I am a RegExp newbie as you can probably see above. I the expression on a
php website and it seemed to fit the purpose. So I have all the INPUT tags
in an array now, and I want to search the array for specifically, the input
tag of "status" so I can find the "APPROVED" value.
I'm not sure if I am going about this the right way but apparently
array_search can't handle searching when the needle is a double quote.
if (array_search("type=\"hidden\" name=\"status\"", $out[1])) {
echo "<br><b>Found Value</b><br>";
} else {
echo "<br><b>NO Value</b><br>";
}
I'd like to be able to see if the transaction was approved or declined and
then go from there. Any suggestions on how I should be going about this
process?
Thanks Group!!
Matt Babineau
criticalcode.com
e:: <mailto:matt@criticalcode.com>
matt@criticalcode.com p:: 603.943.4237