nighi
asked on
Scraping using PHP and xpath
Hi,
I am looking for some assistance to scrap the links using php (curl +xpath) from below location. I tried the xpath way using php but I am unsuccessful. If xpath cannot be used, any other php mechanism is also acceptable.
Input Link: http://network.nighi.com/video?page=2
output: 20 links (e.g. http://network.nighi.com/video/video/show?id=549954%3AVideo%3A140678)
I am looking for some assistance to scrap the links using php (curl +xpath) from below location. I tried the xpath way using php but I am unsuccessful. If xpath cannot be used, any other php mechanism is also acceptable.
Input Link: http://network.nighi.com/video?page=2
output: 20 links (e.g. http://network.nighi.com/video/video/show?id=549954%3AVideo%3A140678)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for you help guys.... I used Ray's code (slightly modified to output only links).
ASKER
Thanks for you help guys.... I used Ray's code (slightly modified to output only links).
I would suggest xml because the data makes more sense in a xml why. To do an xpath or xslt in this page you should first convert this page into proper xhtml or xml. Try to load the page into a DomDocument with the loadHTML() function. If this works you should be able to xpath or xslt the data to get the links. Just ask if you have any issues.