I want to cross list allrecordlabels.com by US state (Alabama, California, New York Mississipi Tennessee, North, South Carolina and Georgia) and genre as following :
A1 LABEL NAME / B1 STATE NAME / C1 MUSICAL GENRE(S) ( and if you know how to add : D1 contact email of the label you can find on the page of some labels) Then make an alphabetical list by collumn.
If there is several genres for a label you can stack them in the same column.
Here some code we worked on :
<?php
$labelsData = array();
$stateListPage = file_get_contents('http://www.allrecordlabels.com/db/state/');
preg_match_all('#<li> <a href="([A-Z]+)\.html">([a-zA-Z ]+)</a></li>#',
$stateListPage,
$statePagesURL);
foreach($statePagesURL[1] AS $statePageURL) {
$statePage = file_get_contents('http://www.allrecordlabels.com/db/state/' .
$statePageURL . '.html');
preg_match('#<h2>State ([a-zA-Z ]+)</h2>#', $statePage, $state);
$state = $state[1];
preg_match_all('#<li><a href="https?://.+\.[a-z]{2,5}">([^<]+)</a>#',
$statePage, $labelsFound);
foreach($labelsFound[1] AS $label) {
if(!isset($labelsData[$label]))
$labelsData[$label] = array('state' => $state);
else
$labelsData[$label]['state'] .= ' - ' . $state;
}
}
/*
$genreListPage = file_get_contents('http://www.allrecordlabels.com/db/genres/');
preg_match_all('#<li> <a href="([^\.]).html">([a-zA-Z /-]+)</a></li>#',
$genreListPage, $genrePagesURL);
print_r($labelsData);*/
?>
All of these informations are listed and easily accesible on the website. Can you help me to make this script working, how do i transfert in excel btw?
Thanks
labels by genre : http://www.allrecordlabels.com/db/genres/
states http://www.allrecordlabels.com/db/state/
labels by state:
Alabama http://www.allrecordlabels.com/db/state/AL.html
Mississipi http://www.allrecordlabels.com/db/state/MS.html
Tennessee http://www.allrecordlabels.com/db/state/TN.html
North Carolina http://www.allrecordlabels.com/db/state/NC.html
South Carolina http://www.allrecordlabels.com/db/state/SC.html
Georgia http://www.allrecordlabels.com/db/state/GA.html