I've spent HOURS searching the net for an answer to this, but can't find it...
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:
[CODE=php]<?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=".$part 1."&Item=".$ite m1."&Qty=".$qty 1."&price=".$pr ice1."&";
$ch = curl_init();
curl_setopt($ch , CURLOPT_POST,1) ;
curl_setopt($ch , CURLOPT_POSTFIE LDS,$dat);
curl_setopt($ch , CURLOPT_URL,$ur l);
curl_setopt($ch , CURLOPT_SSL_VER IFYHOST, 1);
curl_setopt($ch , CURLOPT_USERAGE NT, $user_agent);
curl_setopt($ch , CURLOPT_RETURNT RANSFER,1);
curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, TRUE);
$result=curl_ex ec ($ch);
curl_close ($ch);
echo("Results: <br>".$result );
?>[/CODE]
Somehow I think it needs to redirect (hand over control) when the curl_exec function is called, because this is when the data would be POSTed (but I'm not an expert, so not sure).
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
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:
[CODE=php]<?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=".$part 1."&Item=".$ite m1."&Qty=".$qty 1."&price=".$pr ice1."&";
$ch = curl_init();
curl_setopt($ch , CURLOPT_POST,1) ;
curl_setopt($ch , CURLOPT_POSTFIE LDS,$dat);
curl_setopt($ch , CURLOPT_URL,$ur l);
curl_setopt($ch , CURLOPT_SSL_VER IFYHOST, 1);
curl_setopt($ch , CURLOPT_USERAGE NT, $user_agent);
curl_setopt($ch , CURLOPT_RETURNT RANSFER,1);
curl_setopt($ch , CURLOPT_SSL_VER IFYPEER, TRUE);
$result=curl_ex ec ($ch);
curl_close ($ch);
echo("Results: <br>".$result );
?>[/CODE]
Somehow I think it needs to redirect (hand over control) when the curl_exec function is called, because this is when the data would be POSTed (but I'm not an expert, so not sure).
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