I have 2 php page. I want to redirect page 1 (contains a data (ex. username)) to page 2 that only receive post data.
Here is received code in page 2 (not editable due to development):
if (!$_POST["username"]||$_POST["username"]=="Studio") $username="Studio".rand(100,999);
else $username=$_POST["username"];
I tried to use curl for my case, and not get the data I needed.
Here'e my code in page 1:
$src = "http://test.com/test.php"
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$src);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"username=".$title);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
$this->_redirectUrl($src);
Have you tried using CURL with POST ?
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url); //set URL
curl_setopt($ch,CURLOPT_POST, 1); // make a POST request
curl_setopt($ch,CURLOPT_POSTFIELDS, $post_vars);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
$post_vars
can be something like 'lastname=smith&firstname=bill'