Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //BY JESSE DE ZWART
- //Simple script to get Billboard Hot 100 content.
- //I'm just a new young coder so change it if you think it can be done better.
- //Maybe I'll update for more functions.
- require_once "simple_html_dom.php";
- printList(file_get_contents('http://www.billboard.com/charts/hot-100'),1);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=1'),11);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=2'),21);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=3'),31);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=4'),41);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=5'),51);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=6'),61);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=7'),71);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=8'),81);
- printList(file_get_contents('http://www.billboard.com/charts/hot-100?page=9'),91);
- function printList($html,$i) {
- $html = str_get_html($html);
- foreach($html->find('div') as $element) {
- if ($element->class == "listing chart_listing") {
- $lijst = $element;
- }
- }
- foreach($lijst->find('article') as $element) {
- $title = $element->find('h1');
- $artist = $element->find('a');
- $artist = $artist[0]->plaintext;
- $title = trim($title[0]->plaintext);
- echo $i;
- echo "<br>";
- echo $artist;
- echo "<br>";
- echo $title;
- echo "<br><br>";
- $i = $i + 1;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement