I am trying to grab the content of a site (obviously with their consent) using this code:
use LWP::Simple;
$html = get($url);
@html = split(/\n/,$html);
$count = 0;
foreach $line(@html) {
$count++;
chomp($line);
$line =~ s/\'/\\\'/g;
$line =~ s/\n/<br>/g;
print "document.writeln('$line');\n";
}
----------------------------
Then calling this script using the script tag in my html document.
<script src="http://yourdomain.com/cgi-bin/grab.cgi?http://site-to-grab.com/*html/*cgi etc"></script>
This works fine with the any simple HTML document, but now what I am facing the problem is that the file I am trying to grab contains a lot of javascript in it. So when I try to put javascript into javascript ( "document.writein('$line');\n") it gives me error, I m very weak in regex, I know the solution lies simply in removing
$line =~ s/javascript_tags/replace_them_with_html_comment/g;
or there any other way to get this done?
Thanks in advance,
Zeshan
use LWP::Simple;
$html = get($url);
@html = split(/\n/,$html);
$count = 0;
foreach $line(@html) {
$count++;
chomp($line);
$line =~ s/\'/\\\'/g;
$line =~ s/\n/<br>/g;
print "document.writeln('$line');\n";
}
----------------------------
Then calling this script using the script tag in my html document.
<script src="http://yourdomain.com/cgi-bin/grab.cgi?http://site-to-grab.com/*html/*cgi etc"></script>
This works fine with the any simple HTML document, but now what I am facing the problem is that the file I am trying to grab contains a lot of javascript in it. So when I try to put javascript into javascript ( "document.writein('$line');\n") it gives me error, I m very weak in regex, I know the solution lies simply in removing
$line =~ s/javascript_tags/replace_them_with_html_comment/g;
or there any other way to get this done?
Thanks in advance,
Zeshan