Form submission (no button) using PHP+cURL+ transfer control to other site
I've spent HOURS searching the net for answer to this, but can't find it...
I'm trying to send data using the POST method and also have 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 afterwards. The data gets sort of POSTed to the other site (I get a 200 response back, and I get info showing it was posted correctly), but since the other site does not get control, it seems to dump (not save) the posted data.
Here's my cURL example:
Somehow I think it needs to redirect (hand over control) exactly when the curl_exec function is called, because this is when the data would be POSTed.
$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_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
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, all at the exact same time?
But this also seems to POST the data first, and then redirects to the other site after, which has the same effect of my POSTed data being dumped.
header ("Location: https://www.othersite.com);
Any help would be appreciated.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)