Jump to content

fetchin information


fatmach

Recommended Posts

i need someone tohelp me  build a script that will fetch infomration on a website, and automatically input it into a database. I know its possible i have reaserached it, and it can be done by using the $curl php technique.

it is not a coplicated job i just dont have time for it.

 

i need the script to access diffrent website, at a specific time of day.

 

i want the sript to automaticlly fetch the data from each site at a spesific time during the day.

 

i really dont know where to start... any help will be apprecited.

I managed to come up with this, but it does not do what i want

 

<?php

class tagSpider
{

var $crl; // this will hold our curl instance
var $html; // this is where we dump the html we get
var $binary; // set for binary type transfer
var $url; // this is the url we are going to do a pass on



function tagSpider()
{
$this->html = "";
$this->binary = 0;
$this->url = "";
}


function fetchPage($url)
{


$this->url = $url;
if (isset($this->url)) {

			$this->ch = curl_init (); // start cURL instance
			curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1); // this tells cUrl to return the data
			curl_setopt ($this->ch, CURLOPT_URL, $this->url); // set the url to download
			curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any
			curl_setopt($this->ch, CURLOPT_BINARYTRANSFER, $this->binary); // tell cURL if the data is binary data or not
			$this->html = curl_exec($this->ch); // grabs the webpage from the internet
			curl_close ($this->ch); // closes the connection
			}
}


function parse_array($beg_tag, $close_tag) // this function takes the grabbed html and picked out the pieces we want
{
preg_match_all("($beg_tag.*$close_tag)siU", $this->html, $matching_data); // match data between specificed tags
return $matching_data[0];
}


}
?>

 

 

Link to comment
Share on other sites

i need someone tohelp me  build a script that will fetch infomration on a website, and automatically input it into a database. I know its possible i have reaserached it, and it can be done by using the $curl php technique.

it is not a coplicated job i just dont have time for it.

 

Then why are you here?  This is a forum to help people who are trying to help themselves learn php. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.