Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use LWP::UserAgent;
- use XML::Simple;
- use HTTP::Request;
- my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1) Gecko/20090624 Firefox/3.5');
- $url = "http://feeds.feedburner.com/NewcamdServer";
- my $req=HTTP::Request->new(GET=>$url);
- my $response=$ua->request($req);
- $con = str_replace('Host :','HOST :',$response->content);
- my @posts = split('<img src=', $con);
- foreach my $post (@posts) {
- if ( $post =~ m#(HOST :) (.*)# ) {
- $host = $2 ;
- }
- if ( $post =~ m#(PORT :) (.*)# ) {
- $port = str_replace('&gt;','',$2);
- }
- if ( $post =~ m#(USER :) (.*)# ) {
- $user = str_replace('&gt;','>',$2);
- }
- if ( $post =~ m#(PASS :) (.*)# ) {
- $pass = $2;
- }
- open(a, ">>servers.txt");
- print a "\nHost:$host\nPort:$port\nUser:$user\nPass:$pass\n--------------------------------------";
- close(a);
- }
- sub str_replace {
- my $replace_this = shift;
- my $with_this = shift;
- my $string = shift;
- my $length = length($string);
- my $target = length($replace_this);
- for(my $i=0; $i<$length - $target + 1; $i++) {
- if(substr($string,$i,$target) eq $replace_this) {
- $string = substr($string,0,$i) . $with_this . substr($string,$i+$target);
- return $string; #Comment this if you what a global replace
- }
- }
- return $string;
- }
Advertisement
Add Comment
Please, Sign In to add comment