Skip to content

shmulim/xpath

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

XPATH

This class is from a video tutorial I did on youtube. It is very simple and should be built upon. I will keep this version the same as the video.

##Basic Example

// Create an instance of XPATH
$path = new XPATH("http://example.com");

// An example query. This will grab all the link href attributes from a page
$links = $path->query("//a/@href");

// loop through and output node values
if($links->length > 0){
    foreach($links as $link) {
        echo $link->nodeValue . "<br>";
    }
}

###Youtube videos on Scraping Websites with Xpath

###More useful Links

I dont usually link to w3fools but they have a nice Xpath syntax reference, even MDN links to it.

Hope you find this useful.

-Nate Wiley

Follow me on Twitter

Add me to a circle G+

About

PHP class for scraping websites with XPath.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%