Jump to content

Get data from multi URL with Curl


tazeha

Recommended Posts

Hello I write the code to get and scrap data form website . That website have a navigation page (1,2,3,4,5)

I want auto get data form one page to end page of website.mean(starting scrap from 1 page and then auto get data from two page ,...) .

following is piece of my code witch I write.

require_once "xpath.php";set_time_limit(0);$starUrl= "http://www.digionline.ir/Allprovince/viewcat/%D9%82%DB%8C%D9%85%D8%AA-%D8%AE%D8%B1%DB%8C%D8%AF-%D9%81%D8%B1%D9%88%D8%B4-%D9%85%D8%B4%D8%AE%D8%B5%D8%A7%D8%AA-%D9%84%D9%BE-%D8%AA%D8%A7%D9%BE---Laptop--/cat=10101";function sracperdigi($url){$baseUrl ="http://www.digionline.ir";$array = array();$xpath = new XPATH($url);//pluginha.com$produsttitleQuery = $xpath->query("//span[@class='product-page-detail-wrapper- text']/text()");$produstpriceQuery = $xpath->query("/html/body/div[5]/div/div/div[3]/div[2]/ul/li/span[1]/span[2]/text()");//$produstlinkQuery = $xpath->query("/html/body/div[5]/div/div/div[3]/div[2]/div[2]/span/a");for ($x = 0; $x <40; $x++){$string = $array[$x]['title'] = $produsttitleQuery->item($x)->nodeValue ."*";$string = $array[$x]['price'] = $produstpriceQuery->item($x)->nodeValue ."*";// $string = $array [$x]['link'] =$baseUrl.$produstlinkQuery->item($x)->nodeValue."*";}}
Edited by tazeha
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...