Variable scope or class problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have a Document class that stores the page url and raw content of
page as downloaded from that url.

The start() function creates an instance of Document class called $doc
and calls process(). The process($doc) function downloads the page and
stores the content in $doc->html and then calls the parse($doc)
function. All goes well here.

The problem is that when I try to echo the $doc->html in parse(),
nothing is displayed! I am clueless as to what the problem is? Please



// Document class
class Document {
  var $url;           // url of the document
  var $html;          // raw content of page, as downloaded
  function Document($_url) {
    $this->url = $_url;      

// Main function
function start() {
  $doc = new Document("( product link shortened)"">( product link shortened)");

// Downloads and parses
function process($doc) {
  if(download($doc)) {

// Returns 1 on successful download else returns 0
function download($doc) {
  if(! ($file=fopen($doc->url,"r")) ) {
    return 0;
  while (!feof($file)) {
    $doc->html = $doc->html . fread($file, 4096);
  return 1;

// Parse the page, right now just echo the page
function parse($doc) {
  echo $doc->html;



Site Timeline