views:

181

answers:

2

Hi!

I am trying to develop a sidebar gadget that automates the process of checking a web page for the evolution of my transfer quota. I am almost at it but there is one last step I need to get it working: Sending an HttpRequest with the correct POST data to a php page. Using a firefox plugin, here is what the "Content-Type" of the header looks like:

Content-Type=multipart/form-data; boundary=---------------------------99614912995

with the parameter "boundary" seeming to be random, and the POSTDATA is this:

POSTDATA =-----------------------------99614912995
Content-Disposition: form-data; name="SOMENAME"

Formulaire de Quota
-----------------------------99614912995
Content-Disposition: form-data; name="OTHERNAME"

SOMEDATA
-----------------------------99614912995--

I do not understand how to correctly emulate the POSTDATA with the mystery "boundary" parameter coming back.

Would someone know how I can solve this?

+1  A: 

The actual specification for multipart/form-data is in RFC 2388. Boundary is defined in Section 4.1.

Julian Reschke
+1  A: 

The boundary parameter is set to a number of hyphens plus a random string at the end, but you can set it to anything at all. The problem is, if the boundary string shows up in the request data, it will be treated as a boundary.

For some tips, and an example function for sending multipart/form-data see my answer to this question. It wouldn't be too difficult to modify that function to use a loop for each part you would like to send.

Andy E
Thank you! This helped me to get nearer my goal!Not working yet, but this clarifies ;-)
m6a-uds