Click to See Complete Forum and Search --> : Pinging Blogsearch


edatz
10-24-2009, 02:42 AM
Hi, I don't know if anyone has experience of these, but I've tried a script to ping Google and all it does it just sit there.

The LWP Useragent is on my server.


#!/usr/bin/perl

use strict;
use warnings;
require LWP::UserAgent;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print "Content-type: text/html\n\n";

my $site_name = 'Site Name';
my $site_url = 'http://www.mysite.com/';
my $site_rss = 'myrss.xml';

my %urls = (
'Google' => 'http://blogsearch.google.com/ping/RPC2',
);

my $content = <<EOF;
<?xml version="1.0" encoding="ISO-8859-1" ?>
<methodCall>
<methodName>weblogUpdates.ping</methodName>
<params>
<param><value>$site_name</value></param>
<param><value>$site_url</value></param>
<param><value>$site_rss</value></param>
</params>
</methodCall>
EOF

foreach my $site (keys %urls) {
print "Pinging $site...";

my $req = HTTP::Request->new('POST', $urls{$site});
$req->content_type('text/xml');
$req->content($content);

my $ua = LWP::UserAgent->new;
$ua->request($req)->as_string;
}




Hope someone can help - thanks