title: php curl url ip address binding
body: <p>I am converting some perl code using LWP::UserAgent::DNS::Hosts to php.</p>
  
  <p>What the perl code is doing is making page load time measurements against multiple individual servers in a load balancing pool. Since the servers are using name based virtual hosting, the perl code uses this line to change the url/hostname to ip binding:</p>
  
  <pre><code>    LWP::UserAgent::DNS::Hosts-&gt;register_host(
      'www.mytesturl.com' =&gt; '22.22.22.22',
      );
  
      my $ua = LWP::UserAgent-&gt;new;
      $ua-&gt;timeout(10);
      $ua-&gt;env_proxy;
  
      #actually enforces new DNS settings as if they were in /etc/hosts
      LWP::UserAgent::DNS::Hosts-&gt;enable_override;
  
      $Timerstart=[gettimeofday];
  
      my $response= $ua-&gt;get('http://www.mytesturl.com');
  
      $TimeElapsed = tv_interval ($Timerstart,[gettimeofday]);
  
      if ($response-&gt;is_success) {
         print "&lt;br&gt;Response detected - Time to Load: $TimeElapsed seconds\r\n"
      }
  </code></pre>
  
  <p>I know I can do this with raw socket manipulation, but I was hoping I could do it with cURL or another class library in PHP. The perl code actually repeats this inside a loop with several different IP's for the same url (each ip is a specific server) to test the servers individually.</p>
  
  <p>Thanks-</p>