B
Bint
Hello,
I'm new to web programming, and I've been looking all day on the web for
an answer to this question.
I'm trying to send some binary data, a relatively large amount (~128K), to a
PHP script from a wireless device that has TCP/IP sockets. So I'm sending
all of my data manually (ie ,"POST http://www.blah.com/process.php
HTTP/1.0\n" as my first string).
I am able to send regular form data such as
"tireqty=3&oilqty=4&sparkqty=1&address=4204MainStreet\n\n";
To do this I have a header for the content type like so: "Content-Type:
application/x-www-form-urlencoded\n";" I can get a php script to receive
this and interpret the variables correctly. But when I try to do something
similar with a bunch of binary data, I can't get it to work.
I have even encoded my data in base64 so that it is ready to send as ASCII.
This data is broken into chunks where after each 76 characters there is a
\r\n line break. I read that I needed to do that.
But HOW do I send it? If I send it as form data, with variables, then it
only receives the data up until the first line break. I tried changing the
content type to "Content-Type: application/octet-stream\n", thinking that I
could just send the data without form variables, but then how do you access
that from PHP? For example I tried sending the string "data=XXXYYY" where
XXXYYY is my base64 encoded data, but it didn't work.
I can't seem to find any good documentation about this. Which Content-Type
shouldI be using? Can I use octet-streams and still have the data connected
to php variables? It's very confusing.
Thanks for any pointers.
B
I'm new to web programming, and I've been looking all day on the web for
an answer to this question.
I'm trying to send some binary data, a relatively large amount (~128K), to a
PHP script from a wireless device that has TCP/IP sockets. So I'm sending
all of my data manually (ie ,"POST http://www.blah.com/process.php
HTTP/1.0\n" as my first string).
I am able to send regular form data such as
"tireqty=3&oilqty=4&sparkqty=1&address=4204MainStreet\n\n";
To do this I have a header for the content type like so: "Content-Type:
application/x-www-form-urlencoded\n";" I can get a php script to receive
this and interpret the variables correctly. But when I try to do something
similar with a bunch of binary data, I can't get it to work.
I have even encoded my data in base64 so that it is ready to send as ASCII.
This data is broken into chunks where after each 76 characters there is a
\r\n line break. I read that I needed to do that.
But HOW do I send it? If I send it as form data, with variables, then it
only receives the data up until the first line break. I tried changing the
content type to "Content-Type: application/octet-stream\n", thinking that I
could just send the data without form variables, but then how do you access
that from PHP? For example I tried sending the string "data=XXXYYY" where
XXXYYY is my base64 encoded data, but it didn't work.
I can't seem to find any good documentation about this. Which Content-Type
shouldI be using? Can I use octet-streams and still have the data connected
to php variables? It's very confusing.
Thanks for any pointers.
B