By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

Snoopy help ..

P: n/a
Hi guys, I'm playing with snoopy and am stuck on doing two calls in the same
script. The second call revisits a website after getting an existing link
based on the results of the first call ... If I hard code the URL, then
everything is fine. It's this line that goes wrong
"$newsnoopy->fetchtext($newurl);" ... If I put
$newsnoopy->fetchtext(http://result/of/first/call/); It's fine. Any help
appreciated....

error ... "BAD REQUESTYour client sent a request that this server didn't
understand.Request: "

<?php
include("Snoopy-1.2/Snoopy.class.php");

$snoopy = new Snoopy();
$url = "http://www.thefirsturl.com/?name=".$_GET['inputpc'];;
$snoopy->agent = "Mozilla/8.0";
$snoopy->fetchlinks($url);

$newurl = $snoopy->results[38];;

$newsnoopy = new Snoopy();
$newsnoopy->agent = "Mozilla/8.0";
$newsnoopy->fetchtext("http://www.thesecondurl.com/"); // this works
//$newsnoopy->fetchtext($newurl); // this doesn't
//$newsnoopy->fetchtext($snoopy->results[38]); // this doesn't

echo $newurl."<br>";
//echo $newsnoopy->results;

$exploded=explode(" ",$newsnoopy->results);
echo $exploded[42];
echo "<br>";
echo $exploded[51];
?>
Aug 9 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"elyob" <ne*********@gmail.com> wrote in message
news:42********@news1.homechoice.co.uk...
Hi guys, I'm playing with snoopy and am stuck on doing two calls in the
same script. The second call revisits a website after getting an existing
link based on the results of the first call ... If I hard code the URL,
then everything is fine. It's this line that goes wrong
"$newsnoopy->fetchtext($newurl);" ... If I put
$newsnoopy->fetchtext(http://result/of/first/call/); It's fine. Any help
appreciated....


Thanks to any that read this. I viewed the output source and therer was an
&amp; instead of an & in the URL.

$newurl = str_replace("&amp;", "&", $newurl);
Sorted.

Aug 9 '05 #2

P: n/a
Stick in a debug output to show you what $newurl is being set as, so
you can see if its a properly formatted url.
On Tue, 9 Aug 2005 16:28:12 +0100, "elyob" <ne*********@gmail.com>
wrote:
Hi guys, I'm playing with snoopy and am stuck on doing two calls in the same
script. The second call revisits a website after getting an existing link
based on the results of the first call ... If I hard code the URL, then
everything is fine. It's this line that goes wrong
"$newsnoopy->fetchtext($newurl);" ... If I put
$newsnoopy->fetchtext(http://result/of/first/call/); It's fine. Any help
appreciated....

error ... "BAD REQUESTYour client sent a request that this server didn't
understand.Request: "

<?php
include("Snoopy-1.2/Snoopy.class.php");

$snoopy = new Snoopy();
$url = "http://www.thefirsturl.com/?name=".$_GET['inputpc'];;
$snoopy->agent = "Mozilla/8.0";
$snoopy->fetchlinks($url);

$newurl = $snoopy->results[38];;

$newsnoopy = new Snoopy();
$newsnoopy->agent = "Mozilla/8.0";
$newsnoopy->fetchtext("http://www.thesecondurl.com/"); // this works
//$newsnoopy->fetchtext($newurl); // this doesn't
//$newsnoopy->fetchtext($snoopy->results[38]); // this doesn't

echo $newurl."<br>";
//echo $newsnoopy->results;

$exploded=explode(" ",$newsnoopy->results);
echo $exploded[42];
echo "<br>";
echo $exploded[51];
?>

Aug 9 '05 #3

P: n/a

"M.Waters" <no*@a.chance> wrote in message
news:fp********************************@4ax.com...
Stick in a debug output to show you what $newurl is being set as, so
you can see if its a properly formatted url.

Thanks, it did turn out to be a badly formatted variable.
Aug 9 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.