Created
June 10, 2016 21:40
-
-
Save kjellberg/edbbbb1dc94ec555ad8ec30f59c5673f to your computer and use it in GitHub Desktop.
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 | |
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