Quick Snoopy Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nomb
Forum Newbie
Posts: 19
Joined: Thu May 24, 2007 3:24 pm

Quick Snoopy Question

Post by nomb »

After I use snoopy to get the code for a webpage like below, how am I suppose to display it so you see the page?

feyd | Had to remove posted code as it was well beyond capacity and not very helpful.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Generally, you echo it. If you're referring to loading the images and so forth, you will need to either inject a <base> tag or parse all relative URL references into alternates.
nomb
Forum Newbie
Posts: 19
Joined: Thu May 24, 2007 3:24 pm

Post by nomb »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Sorry, I posted the wrong file.  This is my script.  It looks like ti is already being echo'd.  Do I echo the echo?  Also, this will get the complete source, but how do I make it get the images and everything.  Thank you very much for helping me.  I'm about to pull my hair out.

If you would like to see where I'm at goto: http://www.nombyte.com/spiders.php

Code: Select all

<?php
  
  	include "Snoopy.class.php";
	$snoopy = new Snoopy;

	$url = $_POST["full_url"];
	
	$snoopy->user = "joe";
	$snoopy->pass = "bloe";
	
	if($snoopy->fetch("http://www.slashdot.org/"))
	{
		//echo "response code: ".$snoopy->response_code."<br>\n";
		//while(list($key,$val) = each($snoopy->headers))
		//	echo $key.": ".$val."<br>\n";
		//echo "<p>\n";
		
		echo "<PRE>".htmlspecialchars($snoopy->results)."</PRE>\n";
	}
	else
		echo "error fetching document: ".$snoopy->error."\n";
  
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The snippet is designed to show the markup when the page is loaded. If you remove the <pre> tags and htmlentities() call, it will echo the HTML so the browser can render it as intended (with relative links broken, however)
nomb
Forum Newbie
Posts: 19
Joined: Thu May 24, 2007 3:24 pm

Post by nomb »

You were right. Now it renders the page. How can I get it to cache the images and then pull them from my site?

Also, reading past posts i [s]c[/s] see a command 'curl'. Would that be better for me?

Thanks again,
nomb
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
Post Reply