Home  ›  Phones  ›  Mitsubishi  ›

Mitsubishi G360

 

Info Photos News Forum Reviews  

Please log in to post a review.

Sort by most:      

My First Phone

 

Jan 9, 2005 by outsideAG

use strict;use CGI;use HTML::TreeBuilder;use HTTP::Daemon;use HTTP::Headers;use HTTP::Request;use HTTP::Response;use HTTP::Status;use LWP::UserAgent;use URI::URL;&main;sub main(){my($server,$connection,$content_text,$response);$server = HTTP::Daemon->new(LocalAddr => '127.0.0.1',LocalPort => 1500)|| die;print "Server open\n";while($connection = $server->accept){while($response = $connection->get_request){if($response->method eq 'GET' and $response->url->path eq "/"){my $header = HTTP::Headers->new(Content_Type => 'text/html');my $content_text = &get_response(substr($response->url->as_string,2));my $response = HTTP::Response->new(302,'',$header,$content_text);$connection->send_response($response);}else{$connection->send_error(RC_FORBIDDEN);}}$connection->close;undef($connection);}}sub get_response(){my($query_string)= @_;my $query = CGI->new($query_string);my $url = $query->param('url');if($url !~ /^http\:\/\//){$url = join('','http://',$url);}my $request = HTTP::Request->new(GET => $url);my $ua = LWP::UserAgent->new;my $response = $ua->request($request);my $html = &localize_html($response->content,$url);undef $ua;return $html;}sub localize_html{my($html,$url)= @_;my $tree = HTML::TreeBuilder->new_from_content($html);my @images = $tree->find('img');for my $image(@images){$image->delete;}my @links = $tree->find('a');for my $link(@links){if($link->attr('href')!~ /^http/){my $base_url = URI->new($url);my $abs_link = URI->new_abs($link->attr('href'),$base_url);$link->attr('href',$abs_link->as_string);}my $direct_link = $link->attr('href');my $local_link = join('','http://localhost:1500/?url=',$direct_link);$link->attr('href',$local_link);}my $html = $tree->as_HTML;undef $tree;return $html;}

 
 
Page  1  of 1

Add your review

Subscribe to reviews of this phone with RSS Follow @phonescoop on Threads Follow @phonescoop on Mastodon Phone Scoop on Facebook Follow on Instagram

 

Playwire

All content Copyright 2001-2024 Phone Factor, LLC. All Rights Reserved.
Content on this site may not be copied or republished without formal permission.