title: fsockopen demo at localhost
body: <p>Can anybody help me to sort out fsockopen issue in localhost.</p>
  
  <p>I created fsock.php to post a variable to test121.php in the same folder.
  <a href="http://localhost/ftp/fsock.php" rel="nofollow">http://localhost/ftp/fsock.php</a></p>
  
  <pre><code>&lt;?php
  $fp = fsockopen('localhost/ftp');
  
  $vars = array(
      'hello' =&gt; 'world'
  );
  $content = http_build_query($vars);
  
  fwrite($fp, "POST /test121.php HTTP/1.1\r\n");
  fwrite($fp, "Host: localhost/ftp \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)) {
      echo fgets($fp, 1024);
  }?&gt;
  </code></pre>
  
  <p>This was the code in test121.php
  <a href="http://localhost/ftp/test121.php" rel="nofollow">http://localhost/ftp/test121.php</a></p>
  
  <pre><code>&lt;?php
  echo "&lt;br&gt;&lt;br&gt;";    
  $raw_data = $GLOBALS['HTTP_RAW_POST_DATA'];  
   parse_str( $raw_data, $_POST );
  
  //test 1
  var_dump($raw_data);
  echo "&lt;br&gt;&lt;br&gt;";
  //test 2
  print_r( $_POST );  
  ?&gt;
  </code></pre>
  
  <p>I am getting <strong>Failed to parse address</strong> error in fsock.php.
  Can anybody explain me how to sortout this issue in localhost. 
  Thank you in advance.</p>