...

View Full Version : Simulating post with php



Richard
04-22-2003, 08:52 PM
How can php simulate posting to a page ?

Like how do I get send.php to post something to blah.php and blah.php can use $_post etc without the user having to do anything ?

Kind of like how you can link to a page with ?one=blahtwo=xyz etc and then the page can process it with $_get.

missing-score
04-22-2003, 08:59 PM
<form action="blah.php" method="post" name="someform">
<input type="hidden" name="postvar" value="some value" />
</form>


<script type="text/javascript">
<!--

document.someform.submit();

//-->
</script>




That would make the $_POST vars available on blah.php.

mordred
04-23-2003, 05:01 PM
Either use snoopy, a class that simulates the behaviour of a browser
http://sourceforge.net/projects/snoopy/

or use the cURL extension if it's enabled on your host
http://www.php.net/manual/en/ref.curl.php

Of course you could also use fsockopen() and manually code every single HTTP request, but that's a bit too low-level for my taste and takes too long.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum