[Chugalug] PHP help?

William Wade willm.wade at gmail.com
Wed Nov 28 17:08:16 UTC 2012


I think these are the curl options that you would want to set:

curl_setopt($curl, CURLOPT_HTTPHEADER, "Host: my.wonderful.host");
curl_setopt($curl, CURLOPT_URL, http://10.0.0.1/");


On Wed, Nov 28, 2012 at 8:58 AM, Joe Freeman <joe at netbyjoe.com> wrote:

>  I posted this on StackOverflow, but thought I'd check with folks here to
> see if they have any suggestions-
>
>
> I am converting some perl code using LWP::UserAgent::DNS::Hosts to php.
>
> 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:
>
>     LWP::UserAgent::DNS::Hosts->register_host(
>     'www.mytesturl.com' => '22.22.22.22',
>     );
>
>     my $ua = LWP::UserAgent->new;
>     $ua->timeout(10);
>     $ua->env_proxy;
>
>     #actually enforces new DNS settings as if they were in /etc/hosts
>     LWP::UserAgent::DNS::Hosts->enable_override;
>
>     $Timerstart=[gettimeofday];
>
>     my $response= $ua->get('http://www.mytesturl.com');
>
>     $TimeElapsed = tv_interval ($Timerstart,[gettimeofday]);
>
>     if ($response->is_success) {
>        print "<br>Response detected - Time to Load: $TimeElapsed seconds\r\n"
>     }
>
> 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.
>
> Thanks-
>
> Joe
>
> _______________________________________________
> Chugalug mailing list
> Chugalug at chugalug.org
> http://chugalug.org/cgi-bin/mailman/listinfo/chugalug
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://chugalug.org/pipermail/chugalug/attachments/20121128/ed293c9c/attachment.html>


More information about the Chugalug mailing list