PHP Classes
elePHPant
Icontem

File: MySpy.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of huangjs  >  HTTP Spy  >  MySpy.php  >  Download  
File: MySpy.php
Role: Example script
Content type: text/plain
Description: demo file
Class: HTTP Spy
Crawl and retrieve remote site pages
Author: By
Last change: Version Update
Date: 8 years ago
Size: 1,284 bytes
 

Contents

Class file image Download
<?php
set_time_limit
(0);

require_once(
"config/constant.php");
require_once(
"core/HttpSpy.php");

/* Version 1.0, 11th Sep 2006 - ShagoO ( shagoo@gmail.com) */

Class MySpy extends HttpSpy {
   
    var
$const;
   
    function
MySpy () {
       
$this->const = new Constants;
    }
   
    function
getRequest ($value) {
        if (
array_key_exists($value, $_REQUEST)) {
            return
$_REQUEST[$value];
        }
        return
false;
    }
   
    function
getJoyoCosmePages () {
        for (
$id = 1; $id < 100; $id++) {
            if (
$id < 10) $id = '0'. $id;
           
$pageurl = '/detail/product.asp';
           
$goodsid = 'hibh0100'. $id;
           
$link = array ('path' => $pageurl, 'param' => array('prodid' => $goodsid), 'method' => 'POST');
           
array_push($this->links, $link);
        }
       
$this->conds = array (
               
'price' => $this->const->val['joyo_price_preg_cond'],
        );
// $this->_dumper($this->links);
// $this->_dumper($this->conds);
       
return true;
    }
   
    function
getJoYoCosmeInfos () {
       
$this->create('grocery.joyo.com:80');
       
$this->execute();
        return
true;
    }
   
}

//////////////////////////////////////////////////////////////////////////
// Spy Demo.
$spy = new MySpy;
$spy->getJoyoCosmePages();
$spy->getJoYoCosmeInfos();

echo
"Joyo Productions Price :)<br>";
$spy->_dumper($spy->result);
?>