2011 March — PRONETOFAIL

Monthly Archives: March 2011

Skreemr tool

0
Filed under code, geek, projects
Tagged as , ,

Heres a bit of a larger project I’m working on that will give you the first 10 skreemr mp3 links for a search.

<?php
$q = urlencode($_GET['q']);
$skreemr="http://skreemr.com/results.jsp?q=$q";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $skreemr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
$output = curl_exec($ch);
curl_close($ch);
$re1='.*?';	# Non-greedy match on filler
$re2='((?:http|https)(?::\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))';	# HTTP URL 1
if ($c=preg_match_all ("/".$re1.$re2."/is", $output, $matches))  {
  foreach ($matches[1] as $url) {
    if (preg_match('/mp3/', $url)) {
      echo "&lt;a href=\" $url\" target=new&gt;$url&lt;/a&gt;&lt;br /&gt;";
    }
  }
}
?>