I wonder if I can use PHP to complete a form on another web site and submit it automatically (I need to read the content of the page, select options, enter text into fields, and select links).

I can do this with VB, but would like to do it with PHP or Perl or Python or some other CGI and host it on my sever (I am trying to find an easy way to download data files that I have paid for automatically, so that I can parse them and upload them to a mySQL database for further processing...Doing this manually is time-prohibitive, and doing it with VB seems to restrict me to my home desktop machine, which adds a layer I would rather not add; that and my home machine has only a fraction of the processing power of the server and so takes eons to complete the task).

Anyone have any thoughts on this?

Many thanks!

    sure, [man]fsockopen[/man], [man]fgets[/man] are likely what you will need...

    You can use fsockopen to llink to another page and fgets to suck the contents in, or stream data to another page with [man]fputs[/man]

      many thanks majik-sheff and bastien. i will study the code sample and have already started exploring fsockopen. i'll post my findings and any other questions i might have.

        You might look at [man]curl[/man]. Its more like a wrapper on top of fsocket. You don't have to worry about writing a cookie handler and all that stuff. You just give it some parameters and tell it which URL and off it goes. It also does a great job handling GET and POST data (sending and receiving).

        Check out the php.net link - there's a ton of great curl examples in the user notes.

          Write a Reply...