Anonymous - 2007-12-15


I am trying to get Snoopy pull a page from Yahoo Japan (

I can't get Yahoo to recognise Snoopy as a logged in user.  Initially I thought that rather than worrying about dealing with the login process, I could replicate my browser, like this:

Delete all cookies in FF.  Log into the Yahoo page & check which cookies are set.  Create Snoopy page, setting the same user agent identifier that my FF uses, setting the cookies the same, then loading up a page.  The page loads okay, but instead of saying "Welcome USERNAME" it has a link to login - meaning Yahoo has not read in the cookies.

There seems to be several cookies they issue, I have tried replicaitng them all, altohugh by a process of elimination (deleting each cookie one by one & refreshing the page to see if I am still logged in as me) I have worked out it is looking for two in particular (listed below)

I've done it over and over again, checking cookies for accuracy, I'm not sure what I could be doing wrong.  Here's the code I am using, I have just removed the cookie contents incase they could allow people to replicate my browser & login as me :)

If any Snoopy experts could work out what the story is I will be extreemly grateful :)

Code below....



$snoopy = new Snoopy;

// set browser and referer:
$snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20071127 Firefox/";
$snoopy->referer = "";

$snoopy->cookies['Y'] = 'v=REMOVED; expires=Tue, 02-Jun-2037 20:00:00 GMT; path=/;';
$snoopy->cookies['T'] = 'z=REMOVED; expires=Tue, 02-Jun-2037 20:00:00 GMT; path=/;';

if($snoopy->fetch("")) {

    print "<pre>".htmlspecialchars($snoopy->results)."</pre>\n";
    //print $snoopy->results;
    //$form_array_seperator = '>';
    //$form_array = explode($form_array_seperator,$snoopy->results);
    //foreach ($form_array as $key => $value) {
    //echo 'Key: '.$key.' value: <pre>'.htmlspecialchars($value).$form_array_seperator.'</pre>';
else {
    print "Snoopy: error while fetching document: ".$snoopy->error."\n";