| | |
Autmating posting data to a php-based website
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Using any program that can use sockets you can do this. If you have php installed on your computer then that's easy. I have done it with Game Maker (using 39dll) before.
What you need to do is read the file (word doc) into your program. (You may need to convert it to HTML or something...) Lets assume your using PHP. Use the fopen() function to read the file into a variable, say
Then you want to make a socket connection to your website server:
Each line must end in "\r\n" (PHP notation) and an empty line represents the end of the header and the start of the content.
The above would be the result of submitting the following form:
You then use fputs() to "write" the request to your server and fgets() to "read" the response from your server (which in this case isn't as crucial).
So, load file, connect to server, construct a correct HTTP request, send it, retrieve the reply to your request to make sure it all went ok.
What you need to do is read the file (word doc) into your program. (You may need to convert it to HTML or something...) Lets assume your using PHP. Use the fopen() function to read the file into a variable, say
$file_content .Then you want to make a socket connection to your website server:
$pointer = fsockopen("www.yourdomain.com",80); And then write a HTTP request containing the data. This is what your internet browser does when you submit a form. It should look something like this: PHP Syntax (Toggle Plain Text)
POST /submit.php HTTP/1.1 Host: www.yourdomain.com Connection-length: 24 Connection: close content=Content of file.
The above would be the result of submitting the following form:
html Syntax (Toggle Plain Text)
<form action="www.yourdomain.com/submit.php" method="POST"> <input type="text" name="content" value="Content of file." /> <!-- submit etc. --> </form>
You then use fputs() to "write" the request to your server and fgets() to "read" the response from your server (which in this case isn't as crucial).
So, load file, connect to server, construct a correct HTTP request, send it, retrieve the reply to your request to make sure it all went ok.
★ "If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
![]() |
Other Threads in the PHP Forum
- Previous Thread: PHP Class for Google AJAX Language API (Language Translation)
- Next Thread: group by queries in PHP
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





