Forum Moderators: coopster

Message Too Old, No Replies

Emulating Form Post With Fsockopen

need info about form name in http headers

         

hooperleed

12:50 pm on Jul 6, 2005 (gmt 0)

10+ Year Member



Hello,

I'm working on hsbc epayments.

I'm trying to emulate a payment processing session without leaving my server (so my shop basket looks seamless).

I can initiate the session using fsockopen and connecting to their secure server.

This sends back the html for their welcome screen as I would expect.

It also sets a cookie in their header response so I get-

HTTP/1.1 200 OK Server: computer Date: Wed, 06 Jul 2005 12:34:45 GMT Content-type: text/html; charset=ISO-8859-1 Pragma: no-cache Cache control: no-cache Expires: 0 Set-cookie: JSESSIONID=C810EC618792168649109D2A9A86C5A9;Path=/;Secure Connection: close
<html>etc.

So I parse this information and get what I need.

The next stage is to call the same script with the information that I parsed from above (just a hidden form variable) but now the form has a name :
<form name="cpi_welcome" action="servlet" ..>

Which I guess the script is using to establish the action to take, but I can't find how to pass this to the server via my connection - is not actually in the POST vars or indeed any request variables I can see.

Ofcourse this may be a red-herring and I might need to maintain the session across my connections (I disconnect and reconnnect for every POST emulation) so I might need to send the cookie variable again.

Any thoughts on this would be greatly appreciated.

Cheers,

Lee

lobo235

3:16 pm on Jul 6, 2005 (gmt 0)

10+ Year Member



Have you looked at the CURL library? It should have all the features you need to accomplish this.

Edit:
http://www.php.net/manual/en/ref.curl.php [php.net]