Fwrite ($ socket, "POST $ remote_path HTTP/1.0 \ r \ n ");
Fwrite ($ socket, "User-Agent: Socket Example \ r \ n ");
Fwrite ($ socket, "HOST: $ remote_server \ r \ n ");
Fwrite ($ socket, "Content-type: application/x-www-form-urlencoded \ r \ n ");
Fwrite ($ socket, "Content-length:". (strlen ($ post_string) + 8). '\ r \ n ');
Fwrite ($ socket, "Accept: */* \ r \ n ");
Fwrite ($ socket, "\ r \ n ");
Fwrite ($ socket, "mypost = $ post_string \ r \ n ");
Fwrite ($ socket, "\ r \ n ");
$ Header = "";
While ($ str = trim (fgets ($ socket, 4096 ))){
$ Header. = $ str;
}
$ Data = "";
While (! Feof ($ socket )){
$ Data. = fgets ($ socket, 4096 );
}
Return $ data;
}
Error message:
411 Length Required
------ Solution --------------------
Content-Length
------ Solution --------------------
411 Length Required: The server rejects the request without defining the Content-Length header. after a valid Content-Length header indicating the Length of the request message body is added, the client can submit the request again.
------ Solution --------------------
1. do not attach the username and password to them. use the same number of * numbers to see them ...... Change the password.
2. does HTTP/1.1 200 OK mean the returned result is correct?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service