PHP Post data with Fsockopen
There are many small errors in your code. Here’s a snippet which is tested and works. <?php $fp = fsockopen(‘example.com’, 80); $vars = array( ‘hello’ => ‘world’ ); $content = http_build_query($vars); fwrite($fp, “POST /reposter.php HTTP/1.1\r\n”); fwrite($fp, “Host: example.com\r\n”); fwrite($fp, “Content-Type: application/x-www-form-urlencoded\r\n”); fwrite($fp, “Content-Length: “.strlen($content).”\r\n”); fwrite($fp, “Connection: close\r\n”); fwrite($fp, “\r\n”); fwrite($fp, $content); header(‘Content-type: text/plain’); while (!feof($fp)) … Read more