user = $user; $this->pass = $pass; } public function _login() { $id = $this->id.'login'; $reqs[$id] = new DiggLogin($this->user,$this->pass); return $reqs; } public function _index() { $id = $this->id.'index'; $reqs[$id] = new DiggIndex($user,$pass); $reqs[$id]->cookieFile = $this->cookieFile; $reqs[$id]->attach('success',array($this,'getStories')); return $reqs; } public function _diggStories($n) { if($this->stories && $this->cookieFile) { $stories = array_rand($this->stories,$n); foreach($stories as $i=>$story) { $id = $this->id.'digg'.$i; $reqs[$id] = new DiggStoryDigg($story); $reqs[$id]->cookieFile = $this->cookieFile; } return $reqs; } else { return false; } } //parse list of stories, this can be attached to any request that extracts stories e.g. DiggIndex, DiggCategory etc public function getStories($obj) { if(!empty($obj->stories)) { $this->stories = & $obj->stories; } else { return false; } } } //$c = new CurlBase; //$d = new DiggChain($user,$pass); //$d->login()->profile()->index()->diggStories(4)->index()->category()->buryStories(2)->Category('general')->diggYours($story_id); //while(($requests = $d->doNext())) { // $c->addArr($requests); // $c->perform(); //} ?>