title: Use fsockopen with proxy
body: <p>I have a simple whois script</p>
  
  <pre><code>    if($conn = fsockopen ($whois_server, 43)) {
          fputs($conn, $domain."\r\n");
          while(!feof($conn)) {
              $output .= fgets($conn, 128);
          }
          fclose($conn);
          return $output;
      }
  </code></pre>
  
  <p>$whois_server = whois.afilias.info; //whois server for info domains</p>
  
  <p>but I want to run in through proxy. So I need to connect to proxy -> then connect to whois server -> and then make the request. Something like this?</p>
  
  <pre><code>$fp = fsockopen($ip,$port);
  
  fputs($fp, "CONNECT $whois_server:43\r\n $domain\r\n");
  </code></pre>
  
  <p>But it doesn't work, I don't know if i'm making the second connection right.</p>