I trying to send data using the POST method and also have the control of the browser be turned over to the website that's receiving the POST data (note that this is NOT the same as sending the data via POST method and then redirecting to the website after). I need it to work exactly like hitting the submit button on an html form, and I need it to work from PHP. It needs to POST the data to the site and also let the other site have control at the same time.
I've tried a couple of methods using both cURL and an fsocket function, but it seems like in both cases that (1)the data gets sent to the other site first, (2) then my program gets a response back, (3) and then it redirects to the other site after.
Here's my cURL example:
Expand|Select|Wrap|Line Numbers
- <?php
- $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
- $url = 'https://www.xyz.com/xyz.exe/xyz-AddItem';
- $part1 = 'SB123';
- $item1 = 'blue socks';
- $qty1 = '1';
- $price1 = 5;
- $dat = "PartNo=".$part1."&Item=".$item1."&Qty=".$qty1."&price=".$price1."&";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_POST,1);
- curl_setopt($ch, CURLOPT_POSTFIELDS,$dat);
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
- $result=curl_exec ($ch);
- curl_close ($ch);
- echo("Results: <br>".$result);
- ?>
Is there a way to terminate my php program AND hand the browser over to this other site AND pass the data over using the POST method?
Any help would be appreciated.
Thanks