A web page I am working on loads this page (http://ift.tt/1FsXpS0) into an iframe. There is a button that says "Next" in a form on the page. When the user clicks "Next" the form submits. It calls itself according to the action attribute on the form. The page that returns is step two.
I have changed the iframe so that it loads a php file which requests the same page as above with cURL. I also adjusted the form's Action attribute so that it calls a php file which does a cURL request for the page (http://ift.tt/1FsXpS0). My problem is that I am not able to get Step 2 to appear when I submit the form through the cURL request. How can I get the cURL request to submit the inputs so that step 2 will appear?
Here is the php code that I am using to make the request for the ASP page with the posted inputs from the Step 1 form.
<?php
function getUrlContent($url, $postedVarsMinus1 = NULL)
{
//open connection - initialize cURL handler
$ch = curl_init();
//set fieds to be posted
if(!is_null($postedVarsMinus1))
{
$fields = $postedVarsMinus1;
}
else
{
$fields = "";
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true); //true
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//execute post
$result = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
return ($httpcode>=200 && $httpcode<300) ? array($result, $contentType) : false;
}
?>
Aucun commentaire:
Enregistrer un commentaire