Skip to content

Instantly share code, notes, and snippets.

@kjellberg
Created June 10, 2016 21:40
Show Gist options
  • Save kjellberg/edbbbb1dc94ec555ad8ec30f59c5673f to your computer and use it in GitHub Desktop.
Save kjellberg/edbbbb1dc94ec555ad8ec30f59c5673f to your computer and use it in GitHub Desktop.
<?php
namespace App;
class Grepwords
{
public static function search_volume ( $keyword )
{
$apikey = config('services.grepwords.api_key');
$apiurl = "http://api.grepwords.com/lookup?&apikey=$apikey&loc=sweden&q=".$keyword;
$resp = json_decode(self::curl($apiurl),true); // cmon you dont have php5 yet?
return $resp;
}
private static function curl($url){
$curl = curl_init();
curl_setopt_array($curl,array(CURLOPT_RETURNTRANSFER=>1,CURLOPT_URL=>$url));
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment