Possible Duplicate:
How to parse and process HTML with PHP?
I am trying to get the text from the link that follows the text “Dir:”, e.g. the text between the opening and closing of the “a” tag (name of the Director, here Sam Raimi) using php or regex.
For example
<span class="credit">
Dir: <a href="/name/nm0000600/">Sam Raimi</a>
With: <a href="/name/nm0001497/">Tobey Maguire</a>, <a href="/name/nm0000379/">Kirsten Dunst</a>, <a href="/name/nm0000353/">Willem Dafoe</a>
</span>
Any help would be greatly appreciated!
To get the Director in the Credits, you can use XPath:
This will get you the first a element following the text node containing the string “Dir:” which is child of a span element having a class attribute value of “credit”
See Grabbing the href attribute of an A element for a general usage example on how to work with DOM