I use PHP call API from Google, but the API response is a function. someone know how can I get params "results" in response. Thanks
            Asked
            
        
        
            Active
            
        
            Viewed 79 times
        
    1 Answers
0
            
            
        I found the solution is API response is jsonp, so I use:
function jsonp_decode($jsonp, $assoc = false) { // PHP 5.3 adds depth as third parameter to json_decode
    if($jsonp[0] !== '[' && $jsonp[0] !== '{') { // we have JSONP
       $jsonp = substr($jsonp, strpos($jsonp, '('));
    }
    return json_decode(trim($jsonp,'();'), $assoc);
}
 
    
    
        Badman37
        
- 49
- 3
