not well-formed at line 8, column 0, byte 532 at
c:/Perl/site/lib/XML/Parser.pm
line 168
So I opened parser.pm and went to line 168, it looks like this:
my $result = $expat->parse($arg);
Ok what do I do next, help please! :-)
Thanks
Tom
.
The error occurs somewhere around line 8 in the document
returned (maybe soap or html).
Manfred
You have to make sure to be able to inspect the soap request
(after serialization) as it is sent to the api, and also be able to
inspect the response _before_ it gets parsed.
http://search.cpan.org/~kbrown/SOAP-0.28/lib/SOAP.pm#The_Parser_Object
> Doesn't seem to get to the api at this stage.
What do you think gets parsed if not the response ?
Manfred
Below is the code:
#!C:\perl\bin\perl.exe
# googly.pl
# A Google API Perl Script.
# Usage: perl googly.pl <query>
# Your Google API developer's key.
my $google_key='my google key here';
# Location of the GoogleSearch WSDL file.
my $google_wsdl = "GoogleSearch.wsdl";
use strict;
# Use the sOAP::Lite Perl module.
use SOAP::Lite;
# Take the query from the command line.
my $query = shift @ARGV or die "Usage: perl googly.pl <query>\n";
# Create a new SOAP::Lite instance, feeding it GoogleSearch.wsdl.
my $google_search = SOAP::Lite->service("file:$google_wsdl");
# Query Google
my $results = $google_search ->
doGoogleSearch(
$google_key, $query, 0, 10, "false", "", "false",
"", "latin1", "latin1"
);
# No results?
@{$results->{resultElements}} or exit;
# Loop through the results.
foreach my $result (@{$results->{resultElements}}) {
# Set the results as variables
my $title = $result->{title} || "no title";
my $url = $result->{url};
my $snippet = $result->{snippet} || 'no snippet';
# Strip HTML from the results
$title =~ s!<[^>]+>!!gis;
$snippet =~ s!<[^>]+>!!gis;
# Print out the main bits of each result
print
join "\n",
$title,
$url,
$snippet,
"\n";
}
I dont know if it is reaching the api.
Maybe everything gets parsed except for line 8?
Tom