library/Search/Google.php
public function search($keyword = null, $startingIndex = 1)
    {
        // Handle if keyword is null or empty string
        if ($keyword === null || $keyword === '') {
            return false;
        }

        $url = 'https://www.googleapis.com/customsearch/v1?key=' . $this->apiKey .
               '&cx=' . $this->apiCx .
               '&q=' . urlencode($keyword) .
               '&hl=sv&siteSearchFilter=i&alt=json&start=' . $startingIndex;

        $results = $this->request($url);
        return $results;
    }
public function search($keyword = null, $startingIndex = 1)
    {
        // Handle if keyword is null or empty string
        if ($keyword === null || $keyword === '') {
            return false;
        }

        $url = 'https://www.googleapis.com/customsearch/v1?key=' . $this->apiKey .
               '&cx=' . $this->apiCx .
               '&q=' . urlencode($keyword) .
               '&hl=sv&siteSearchFilter=i&alt=json&start=' . $startingIndex;

        $results = $this->request($url);
        return $results;
    }
public function search ( $ keyword = null , $ startingIndex = 1 ) { // Handle if keyword is null or empty string if ( $ keyword === null || $ keyword === '' ) { return false ; } $ url = 'https://www.googleapis.com/customsearch/v1?key=' . $ this -> apiKey . '&cx=' . $ this -> apiCx . '&q=' . urlencode ( $ keyword ) . '&hl=sv&siteSearchFilter=i&alt=json&start=' . $ startingIndex ; $ results = $ this -> request ( $ url ) ; return $ results ; }
Perform a search with the Google Custom Search API
@param  string  $keyword The search query/keyword
@param  integer $start   Starting search result index (used for pagination)
@return object           The search results
Perform a search with the Google Custom Search API