I have a page I need to get the contents of on my own page. The peculiar thing is that the page returns the correct information only when the value of the submit button is kept as it is. So when I make a form as
<form action="http://ift.tt/1SgQju5" method="POST">
<input name="rid" type="TEXT"><br>
<input name="submit" type="SUBMIT">
</form>
the correct result is returned. But when I manually send a post data with "rid" as my query, the correct data is not retrieved. So my question is, how do I get the file contents through php using the above form as it is.
<?php
$query=$_GET['query'];
$postdata = http_build_query(
array(
'rid' => $query
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
echo file_get_contents("mydestinationpage.php",false,$context);
?>
this is how i tried to do it and it doesn't give the required result.
Aucun commentaire:
Enregistrer un commentaire