FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


http header for POST





TomS
Hi there.
I need the headerdata to send textstrings via POST to a phpscript

For GET it would like this.
Code:
"GET /directory/file.php?var1=test HTTP/1.1"
"Host: my.server.com"
"Accept: */*"
"Connection: Close"


For POST I'm so far:

Code:
"POST /directory/file.php HTTP/1.1"
"Host: my.server.com"
"string=blablabla"
"Content-Lenght: 22"
"Connection: Close"


But the return is as follows:

Quote:
Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

string=blablabla


I don't have the command for sending the "string=blablabla"...

Does anybody know?
sonam
I am not sure, like always Rolling Eyes , but in your second code you have:
Code:
"string=blablabla"


Maybe you need change this in:
Code:
"string:blablabla"


Sonam
hexkid
TomS wrote:
I need the headerdata to send textstrings via POST to a phpscript
I usually use cURL for that.
MrBlueSky
TomS wrote:

Code:
"POST /directory/file.php HTTP/1.1"
"Host: my.server.com"
"string=blablabla"
"Content-Lenght: 22"
"Connection: Close"




Should be:

Code:

"POST /directory/file.php HTTP/1.1"
"Host: my.server.com"
"User-Agent: Mozilla/4.0"
"Connection: Close"
"Content-Type: application/x-www-form-urlencoded"
""
"string=blabla&anotherstring=moreblabla&thirdstring=okethenbla"


Don't forget to include the blank line to end the headers: with POST the data doesn't go in the header, but in the body of the request.

See also: http://www.jmarshall.com/easy/http/#othermethods
TomS
Ok. I changed the code. and added the blank line. Now it's conform with 3 different sources. But I just can't get it to work. Now I get response 200: Ok, but the variable isn't submit. I know that the phpscript works fine, because it does the expected, when I submit a string via htmlform. Thanks for your replies.

And it's not for php but a Basicdialect called PureBasic. I really need to get long textstrings from a pc to the internet. If anyone has another solution for such thing, please tell me. I also tried sending an email, but the emaillibraries for purebasic don't work Sad
Related topics
HELP: setcookie() and header problems
Where should I post a request?
script backup database
[ java scripts ] email service
phpbb
Sending POST information
how to prevent double post when user klik F5 *Refresh* ?
.::~Make a Header Banner - Get 150 Frih$~:..
'POST' and redirects
Header and Footer Files? [RESOLVED]
Html/flash in Forum post
Header problems
POST a form in the Same page
Manipulate (Play) with callback html result of JQuery Post
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.