I think these are the curl options that you would want to set:<div><br></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">curl_setopt($curl, CURLOPT_HTTPHEADER, </span><span style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">"Host: my.wonderful.host"</span><span style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">);</span><br style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">

<span style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">curl_setopt($curl, CURLOPT_URL, </span><a rel="nofollow" href="http://10.0.0.1/%22" target="_blank" style="color:rgb(43,62,174);text-decoration:initial;font-family:Verdana,Georgia,serif;font-size:14px">http://10.0.0.1/"</a><span style="color:rgb(0,0,0);font-family:Verdana,Georgia,serif;font-size:14px">);</span></div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 28, 2012 at 8:58 AM, Joe Freeman <span dir="ltr"><<a href="mailto:joe@netbyjoe.com" target="_blank">joe@netbyjoe.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


I posted this on StackOverflow, but thought I'd check with folks here to see if they have any suggestions-<br></p><p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


<br></p><p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


I am converting some perl code using LWP::UserAgent::DNS::Hosts to php.</p><p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


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 style="max-height:600px;text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;width:auto;font-style:normal;background-color:rgb(238,238,238);font-weight:normal;padding:5px;vertical-align:baseline;line-height:18px;text-transform:none;font-size:14px;overflow:auto;margin:0px 0px 10px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;border:0px;background-repeat:initial initial;word-spacing:0px">

<code style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:rgb(238,238,238);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;background-repeat:initial initial"><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">    LWP</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">UserAgent</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">DNS</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Hosts</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">register_host</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">(</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">'<a href="http://www.mytesturl.com" target="_blank">www.mytesturl.com</a>'</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">=></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">'22.22.22.22'</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">,</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">);</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">my</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> $ua </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">=</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> LWP</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">UserAgent</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">new</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">;</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    $ua</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">timeout</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">(</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">10</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">);</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    $ua</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">env_proxy</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">;</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:gray;background-repeat:initial initial">#actually enforces new DNS settings as if they were in /etc/hosts</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    LWP</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">UserAgent</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">DNS</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">::</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(43,145,175);background-repeat:initial initial">Hosts</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">enable_override</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">;</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    $Timerstart</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">=[</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">gettimeofday</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">];</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">my</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> $response</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">=</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> $ua</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">get</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">(</span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">'<a href="http://www.mytesturl.com" target="_blank">http://www.mytesturl.com</a>'</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">);</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    $TimeElapsed </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">=</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> tv_interval </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">(</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">$Timerstart</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">,[</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">gettimeofday</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">]);</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">

    </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">if</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">(</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">$response</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">-></span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">is_success</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">)</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">{</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
       </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(0,0,139);background-repeat:initial initial">print</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial"> </span><span style="margin:0px;padding:0px;border:0px;font-size:14px;vertical-align:baseline;background-color:transparent;color:rgb(128,0,0);background-repeat:initial initial">"<br>Response detected - Time to Load: $TimeElapsed seconds\r\n"</span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">
    </span><span style="vertical-align:baseline;font-size:14px;background-color:transparent;margin:0px;border:0px;padding:0px;background-repeat:initial initial">}</span></code></pre><p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


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 style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


Thanks-</p><p style="text-indent:0px;letter-spacing:normal;text-align:left;font-variant:normal;font-style:normal;font-weight:normal;padding:0px;vertical-align:baseline;clear:both;line-height:18px;text-transform:none;font-size:14px;white-space:normal;margin:0px 0px 1em;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;word-wrap:break-word;border:0px;background-repeat:initial initial;word-spacing:0px">


Joe<br></p>
<br>_______________________________________________<br>
Chugalug mailing list<br>
<a href="mailto:Chugalug@chugalug.org">Chugalug@chugalug.org</a><br>
<a href="http://chugalug.org/cgi-bin/mailman/listinfo/chugalug" target="_blank">http://chugalug.org/cgi-bin/mailman/listinfo/chugalug</a><br>
<br></blockquote></div><br></div>