Skip to content

Commit

Permalink
added another PHP example
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Feb 27, 2012
1 parent 451c7f2 commit f660a1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions s/index.md
Expand Up @@ -19,6 +19,7 @@ This site shows you how.

Thanks to the following folks for their contributions:

* Anubhava Srivastava
* Nathan Mahdavi
* Jeffrey Kegler
* Bill Ricker
Expand Down
8 changes: 8 additions & 0 deletions s/php.md
Expand Up @@ -11,6 +11,14 @@ HTML parsing in PHP is done with the
}
$html = $dom->saveHTML();

Here's an example for pulling out any `<a>` tags with the `nofollow` attribute:

$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html); // loads your HTML
$xpath = new DOMXPath($doc);
// returns a list of all links with rel=nofollow
$nlist = $xpath->query("//a[@rel='nofollow']");

# Notes

Expand Down

0 comments on commit f660a1a

Please sign in to comment.