I am not sure where to post this topic but I though this section is the right one.

I have a large amount of data in a MS word file. Basically, I want to automate the posting of this data into my website through the normal form of posting topics into my website.

Is there any way to do that?

8 Years
Discussion Span
Last Post by khr2003

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 $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:

POST /submit.php HTTP/1.1
Host: www.yourdomain.com
Connection-length: 24
Connection: close

content=Content of file.

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:

<form action="www.yourdomain.com/submit.php" method="POST">
  <input type="text" name="content" value="Content of file." />
  <!-- submit etc. -->

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.