• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: POST message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: POST message


  • Subject: Re: POST message
  • From: Heath Raftery <email@hidden>
  • Date: Mon, 05 Sep 2005 22:54:56 +1000

Hi Jan,

I think I may be able to offer some advice, but we need to clarify a few things first...

On 05/09/2005, at 9:39 PM, Jan E. Schotsman wrote:
I need some help with a simple (?) job. I want to query a URL and download and parse the answer.

The URL points to a resource on a server you have no control over then? That is, you essentially want to take the place of a client web browser, and post a form to someone else's server?


Basically I need to do the equivalen t of filling in two text boxes, clicking a button, wait for the answer page to appear and read it.

The equivalent of a web browser doing that, right?

I cannot directly download the answer URL because the path contains elements that I cannot predict.

Fine.

I understand I need to set a POST message but what data do I need to send? Do I need to send a "Press button" message too?

You're sure it's a POST message then? Because there are a few ways this can be done. If it's a regular run of the mill HTML FORM element, the author may specify the POST method (where you include the submitted information in the content of the HTTP request) or the GET method (where the submitted information appears encoded in the URL, after the address of the resource that services the request).


No, you don't need to send a "Press button" message. The server doesn't care whether a button was pressed, that's just a suggestion to the browser client that it should package up the form data, construct a POST message, and send it to the server. All the server cares about is that it got the POST message. Actually, it's possible that all that is incorrect, if the original web page uses Javascript, or any other scripting language, but lets hope things are not complicated in that manner.

Is the response indeed the answer page, or its text?

If I understand you correctly, the response is the entire HTTP response, with a HTTP header followed by the HTML of the response page. You'd need to parse this to find the response you were looking for.


Now continuing with the assumptions I've made, my recommendation would be to simply packet sniff the traffic when the web browser performs the task. You should see traffic like this:

server->client: HTTP response 200 followed by HTML page with form
client->server: HTTP POST request containing form data
server->client: HTTP response 200 followed by HTLM response page

The part you want to imitate is of course, the client->server message. It should be plain text and therefore easy to parse and imitate. Just make sure you get all the CRLF's (carriage return, line feeds - the end of line markers in HTTP) right. It is possible to figure out what the client->server message would be, by looking at the form page HTML, as your client browser does, but why bother? The browser does all that hard work, and all you have to do is take a peek at what it comes up with.

Hope this helps,
Heath

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: POST message
      • From: "Jan E. Schotsman" <email@hidden>
References: 
 >POST message (From: "Jan E. Schotsman" <email@hidden>)

  • Prev by Date: POST message
  • Next by Date: Re: POST message
  • Previous by thread: POST message
  • Next by thread: Re: POST message
  • Index(es):
    • Date
    • Thread