Safe and Dirty Remote XMLHttpRequest
Safe and Dirty Remote XMLHttpRequest Sometimes we need XMLHttpRequest work on diferents domains (cross domains) a simple solution, you need JavaScript and Perl:
The XMLHttpRequest(); example:
var req = new XMLHttpRequest() // IE7, Firefox, Safari, Opera req.open('GET', 'http://localhost/cgi-bin/remote.pl?url='+url, false); req.send(null);
To make the remote request work, use remote.pl:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/usr/bin/perl use LWP::UserAgent; use CGI qw(:standard); print "Content-type: text/plain\n"; my $url = param ('url'); $ua = LWP::UserAgent->new; $ua->agent("Mozilla/8.0"); $req = HTTP::Request->new(GET => $url); $req->header('Accept' => 'text/html'); $res =$ua->request($req); if ($res->is_success) { $page = $res->content; } else { $page = "error"; } print $page; |
This is only a example:
The remote.pl could be much better implement (GET and POST methods, params and theirs values).



que tal?, solo escribia para felicitarte por tu sitio
If possible please avoid using yellow color for the text – its unreadable on the white background.
By the way, this method is called ‘using a proxy’ – very useful in some situations. But you have to be careful using it – it can open XSS vulnerabilities on your site.