Created
June 16, 2012 03:17
-
-
Save davelester/2939776 to your computer and use it in GitHub Desktop.
Snippet of PHP I wrote to generate list of urls for each year, separated by new line. called on command line, 'php filename > 2001urls.txt'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mysqli = new mysqli('localhost', 'root', '', 'syllabi_scraper'); | |
if ($mysqli->connect_error) { | |
die('Connect Error (' . $mysqli->connect_errno . ') ' | |
. $mysqli->connect_error); | |
} | |
if ($result = $mysqli->query("SELECT url FROM syllabi WHERE url LIKE '%2001%'")) { | |
while($obj = $result->fetch_object()){ | |
echo ($obj->url . "\n"); | |
} | |
/* free result set */ | |
$result->close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment