Jump to content

Recommended Posts

Posted (edited)

Hi,

A follow up from here I now trying to use the *Post_Server* script from here

in a POST response back to the script this is what i managed to receive (a POST back from a submitted form)

Accept: */*
Content-Length: 1283
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------2b466814ebaf785b

That is some sort of an array, right ?
Any one have an idea how it can be made to be received in readable format and in to an array perhaps

Thanks

Edit:  I have been explained it is done in PHP like so, where print_r($post, TRUE) is the real deal

<?php
$file = 'textfile.txt';
$post = stripslashes_deep($_REQUEST);
$post_content = print_r($post, TRUE);
$fp = fopen($file, 'w') or die('Could not open file!');
fwrite($fp, $post_content) or die('Could not write to file');
fclose($fp);
?>

 

Edited by Deye
Posted (edited)

Thanks Kyan,

well I'm still not sure how to make the multi client server script do requests @what points .etc 
so far, if I set the webhook to go with RequestBin this is the info I get:  https://requestb.in/1g1olv41?inspect

Edited by Deye
Posted

Just to see if im understanding ..,so this is treated as a header that comes as POST

Content-Type: multipart/form-data; boundary=------------------------2b466814ebaf785b


Then what ? , I determine that the header contains the string "boundary=--" and then make a request to the forms address at the address where its been submitted to  receive data
Still not sure what to try ..

Thanks

Posted

When a request comes with boundary, here's what it looks like (example taken from HTML specs posted by @Kyan):

Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"; filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --AaB03x--

As you can see, the boundary is used as separator between the different form inputs, such that:

  • --[boundary] is used to separate different inputs
  • --[boundary]-- is used at the end of the request

However note that it only happens when you're using `<form enctype="multipart/form-data" method="post">`. If you are using just `<form method="post">`, you will only get a URL encoded line with all the key=value pairs of form inputs at the last line of the request as I posted on the other thread (no boundaries needed). However you are only able to accept file uploads with multipart/form-data (so if you are not willing to do file uploads, I'd recommend not to use this encoding type).

My stuff

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...