Created
January 24, 2011 16:37
-
-
Save lplume/793487 to your computer and use it in GitHub Desktop.
mini wrapper web based, look for questions w/ tagged and min score given
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 | |
/* | |
* uri param to this "web script" | |
* q = tag values split by a semicol | |
* minscore = min score (int) | |
* | |
* it's a lil bit nasty, but can modify so easy, the same to turn into a shell script | |
*/ | |
$url = "http://api.stackoverflow.com/1.0/questions?tagged=".urlencode($_GET["q"]); | |
$str = array(); | |
$max = 30; | |
$minscore = isset($_GET["minscore"]) ? $_GET["minscore"] : 0; | |
for ($i = 1; $i < $max; $i++) { | |
$temp = ""; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "$url&page=$i"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch,CURLOPT_ENCODING,'gzip'); | |
$temp = curl_exec($ch); | |
curl_close($ch); | |
$json = json_decode($temp); | |
foreach($json->questions as $q) | |
if($q->score > $_GET["minscore"]) | |
echo "<p>[ $q->score ] $q->title <a href='http://stackoverflow.com/questions/".$q->question_id."'>open</a></p>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment