Page 1 of 1

HSBC CPI Integration

Posted: Tue Jul 24, 2007 11:28 am
by gurjit
has anyone integrated HSBC CPI before?

I have it working with the sample.html file they supply. I used the following to integrate it:

http://www.leadingedgescripts.co.uk/hsb ... slinux.php

the problem I have is that it displays the /cgi-bin/CcOrderHash.e page but I want to skip this page and go straight to the HSBC page. How can I do this?

What I dont understand is the bottom part of what this document is talking about and what this code is attempting to do:

Code: Select all

<?php
$postdata = array2String($_POST);

				$fp = fsockopen("www.yourdomain.com", 80);
	
				if (!$fp) 
				{
				echo "Couldn't open the connection to OrderHash.e file";
				} 
				else
				{
					/***************************
					|lets build our post request
					***************************/
					$out = "POST /cgi-bin/OrderHash.e HTTP/1.1\r\n";
					$out .= "Host: http://www.yourdomain.com\r\n";
					$out .= "Accept:text/xml,application/xml,application/zhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
					$out .= "Accept-Language: en\r\n";
					$out .= "Accept-Encoding: gzip,deflate\r\n";
					$out .= "Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n";
					$out .= "Keep-Alive: 300\r\n";
					//$out .= "Referer: http://www.yourdomain.com/hsbc/sample.html\r\n";
					$out .= "Content-Type:application/x-www-form-urlencoded\r\n";
					$out .= "Content-Length: ". strlen($postdata) ."\r\n";
					$out .= "Connection: close\r\n\r\n";
					$out .= $postdata;
					
					/*****************************
					|This passes our POST headers 
					|to the OrderHash.e form
					*****************************/
					fwrite($fp, $out);

?>
"I've also been asked "what next?", well $fp can be treated like a file and read back into your script, if you read it into a string you will have an exact copy of the HTML output of the OrderHash.e file to play with, all you need to do then is strip out the stuff you don't want and output the stuff you do. Hope that helps."

How do I use this to read back and submit the CcOrderHash.e page?

Any help would be appreciated. This HSBC CPI is a pain. There instructions are rubbish.