POST to YAWS using fsockopen
Posted: Wed Jun 22, 2005 6:25 am
Hi,
I am trying to do a POST to a form which resides on a YAWS server.
This is the code I use to send the POST:
This is the response I get from the server:
HTTP/1.1 200 OK
Server: Yaws/1.31 Yet Another Web Server
Date: Wed, 22 Jun 2005 10:53:26 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
1B
1 Missing id parameter
I am not all that experienced with sending POST requests through sockets, but I have done this successfully in the past (although only with Apache).
Do you see any errors in my code? Does YAWS require some other format than this?
If you don't know exactly what's going on I'd also appreciate pointers on where I can read something related to my problem.
TIA,
Selma
I am trying to do a POST to a form which resides on a YAWS server.
This is the code I use to send the POST:
Code: Select all
$host="www.myserver.com";
$path="/webcmd/getData";
$query="id=".$var."&force=true";
$post = "POST $path HTTP/1.1\r\n";
$post .= "Host: $host\r\n";
$post .= "Content-type: application/x-www-form-urlencoded\r\n";
$post .= "Content-length: ".strlen($query)."\r\n\r\n";
$post .= "$query\r\n";
$post .= "Connection: close \r\n\r\n";HTTP/1.1 200 OK
Server: Yaws/1.31 Yet Another Web Server
Date: Wed, 22 Jun 2005 10:53:26 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
1B
1 Missing id parameter
I am not all that experienced with sending POST requests through sockets, but I have done this successfully in the past (although only with Apache).
Do you see any errors in my code? Does YAWS require some other format than this?
If you don't know exactly what's going on I'd also appreciate pointers on where I can read something related to my problem.
TIA,
Selma