SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK - it's easy enough to use PHP to grab the contents of an external web page, but I need to go a step further. I want to write a script that can post information to an external site, grab the HTML sent back by that site and then analyse the returned code. Basically my PHP script has to emulate a web browser posting information from a form.

    Does anyone have any idea how I can do this? It's for - belive it or not - a practical joke (on a colleague so no legal implications there )

  2. #2
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,937
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could just echo the variables in the query string. Chances are that will work.
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  3. #3
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to open a socket ( http://www.php.net/fsockopen ) to the page or you can use fopen() ( http://www.php.net/fopen ) depending on the situation.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  4. #4
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it not possible to post form variables using headers? I've checked and I definitely need to psot - get is not an option.

  5. #5
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tip top...

  6. #6
    SitePoint Addict kunal's Avatar
    Join Date
    Oct 2000
    Posts
    307
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To post stuff to an external form, all you need to do is encode the URL to have http://www.websitename.com/formprocessor.php?name=$name&blah=blee$etc etc..

    You can submit information externally. But getting information back from the form is not possible, because the external site will not send anything to you. What you could try to do though, is load everything up in frames. Let the top frame send the stuff, and the bottom frame process it. You could then extract the headers to.
    i dunno...


Bookmarks

Posting Permissions

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