Simulate the http request Returnsarraywithheadersin $ response [0] andbodyin $ response [1] functionhttp_post ($ request, $ host, $ path, $ port80, $ ipnull) using php) {$ http_request simulate an http request using php
// Returns array with headers in $ response [0] and body in $ response [1] function http_post ($ request, $ host, $ path, $ port = 80, $ ip = null) {$ http_request = "POST $ path HTTP/1.0 \ r \ n"; $ http_request. = "Host: $ host \ r \ n"; $ http_request. = 'content-Type: application/x-www-form-urlencoded; charset = '. get_option ('blog _ charset '). "\ r \ n"; $ http_request. = "Content-Length: {$ content_length} \ r \ n"; $ http_request. = "User-Agent: {$ akismet_ua} \ r \ n"; $ http_request. = "\ r \ n"; $ http_request. = $ request; $ response = ''; if (false! = ($ Fs = @ fsockopen ($ http_host, $ port, $ errno, $ errstr, 10) {fwrite ($ fs, $ http_request); while (! Feof ($ fs) $ response. = fgets ($ fs, 1160); // One TCP-IP packetfclose ($ fs); $ response = explode ("\ r \ n", $ response, 2);} return $ response ;}