Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $file = "http://www.metalstorm.net/events/new_releases.php";
- libxml_use_internal_errors(true);
- class RecordsFetcher {
- function __construct($url) {
- $this->contents = file_get_contents($url);
- $dom = new DOMDocument();
- $dom->loadHTML($this->contents);
- $xpath = new DomXPath($dom);
- $nodes = $xpath->query("//*[contains(@class, 'padding-10')]");
- foreach($nodes as $i => $node) {
- if ($i == 2) {
- $books = $node->getElementsByTagName('tr');
- foreach($books as $j => $n) {
- $trimmed = trim($n->nodeValue);
- $date = substr($trimmed, 0, 5);
- $album = substr($trimmed, 5);
- var_dump(trim($album));
- }
- }
- }
- }
- }
- $records = new RecordsFetcher($file);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement