Sorry, I didn't look at my code closely enough. Here's
the solution that should work for you (i was using a
proxy server to send the request).
sub httpRequest {
my $get_url = shift;
my $ua = LWP::UserAgent->new(timeout => 5);
$ua->agent("Some User Agent"); #not necessary
my $req = HTTP::Request->new(GET => $get_url);
$req->referer("-"); #typed in url effect
my $http_response = $ua->request($req);
my $response;
if ($http_response->is_error()) {
$response = sprintf " %s",
$http_response->status_line;
} else {
$response = $http_response->content();
}
return $response;
}
--- Anthony Ettinger <[EMAIL PROTECTED]> wrote:
>
>
>
> use LWP::UserAgent
> use HTTP::Request
>
> $proxy = $url; #or just replace $proxy with $url.
>
> my $response = &httpRequest($proxy);
>
> sub httpRequest {
> my $proxy = shift;
> my $ua = LWP::UserAgent->new(timeout => 2);
> $ua->agent("Anti-War v2.0");
> $ua->proxy('http', "http://$proxy");
> my $req = HTTP::Request->new(GET =>
> $get_url);
> $req->referer("-"); #typed in url effect
> my $http_response = $ua->request($req);
> my $response;
> if ($http_response->is_error()) {
> $response = sprintf " %s",
> $http_response->status_line;
> } else {
> $response =
> $http_response->content();
> }
> return $response;
> }
>
> --- "Ing. Ricardo Cumberbatch L. (PANNet - URC)"
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > How could i do example:
> >
> > Server B execute a page from Server A and saved
> the
> > information and
> > send it to Server C.
> >
> > Server C couldn't know that the infomation came
> from
> > Server A. I found
> > that in PHP is do in this way:
> >
> > function verificar_url($url)
> > {
> > //abrimos el archivo en lectura
> > [EMAIL PROTECTED]($url,"r");
> > //hacemos las comprobaciones
> > if ($id) $abierto=1;
> > else $abierto=0;
> > //devolvemos el valor
> > return $abierto;
> > //cerramos el archivo
> > fclose($id);
> > }
> >
> >
> >
> > $url= "http://www.skytel.com.co";
> >
> >
> > $Resultado= verificar_url($url);
> >
> > echo " Resultado $Resultado ";
> > if ($Resultado == 1)
> > {
> > echo " DIRECCION EXISTENTE ";
> > // Aqui puede ingresar la rutina para traer la
> > informacion del sitio
> > web
> > }
> > else
> > {
> > echo " DIRECCION NO EXISTENTE o FUERA DE
> > LINEA ";
> >
> >
> > }
> > la primera es la funciC, y la otra parte es el
> > uso de @ delante de fopen es para que en caso de
> > error no se muestre en la pantalla
> >
> >
> > How could I do something like this or work like
> it.
> >
> > Thank for the help
> >
> > _______________________________________________
> > Perl-Unix-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe:
> http://listserv.ActiveState.com/mailman/mysubs
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs