Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    England
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simulating post with php

    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.
    \o/

  • #2
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <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.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •