LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I send a post query with attached data using Labview?

Hi,
I need to send data (a file of 5KB) to a php server.
In order to do it, I need to send a post request with attached data.
I'm using Labview 6.1 and I have the Internet Toolkit.

But I just see the Get Method. Isn't implemented the post method in Labview?

Thanks for your help

Best regards
0 Kudos
Message 1 of 2
(3,043 Views)
Hi,

In order to use the POST request method as opposed to the GET request method I used a VI set up as shown in the attached GIF.

From the front panel you need to provide values for the 3 inputs. "Bytes to read" is an arbitrarily large number that meets or exceeds the maximum number of bytes you expect as a response from your server. "Address" is just the URL of the server, e.g. "10.90.1.1" or "localhost" or "www.google.com". "Data in" is the actual request you're sending with the data included.

"Data in" would be in a format similar to everything in the quotes below (important to have 2 carriage returns to finish the request);

"
POST /phppage.php HTTP/1.1
Content-Length: ??
Host: http://www.mywebserver.com
Content-Type: application/x-www-form
-urlencoded

email=neil_m_price@hotmail.com&password=mypassword

"

For sending your data file you just have to set the requisite MIME-type and then include the file data in place of the form data in the example above.

Hope this helps,
Neil
0 Kudos
Message 2 of 2
(3,043 Views)