title: PHP fsocketopen Though Proxy
body: <p>I am currently using PHP to open up a port 43 connection to get whois information directly from a registry using this code.</p>
  
  <pre><code>// connecting to the whois server.  
  $handle = fsockopen($server, 43);  
          if (!$handle)  
              return false; // connection failure   
  
  
          //asking the server  
          fwrite($handle, $domain_name."\r\n");  
  
  
          // getting response  
          $response = '';  
          while (!feof($handle))  
              $response .= fgets($handle, 1024);  
  
          fclose($handle);
  </code></pre>
  
  <p>It works great however I want to connect though a proxy server so I route my intertent connection through it. If this were able to use cURL I would use curl_setopt($curl_handle, CURLOPT_PROXY, $ip_address . ':4040'); but i can not find a way to do this using fsocketopen. How can I accomplish this either with cURL or fsocketopen()?</p>