網頁

2013年10月28日 星期一

google app engine curl php




CURL is not supported on Google App Engine for PHP. 



Replacing CURL with urlfetch in PHP


https://developer.foursquare.com/resources/libraries

FoursquareAPI.class.php
 
 private function Request($url,$params=false,$type=HTTP_GET){

  // Populate data for the GET request
  if($type == HTTP_GET) $url = $this->MakeUrl($url,$params);

  // borrowed from Andy Langton: http://andylangton.co.uk/
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  
               // Populate data for the GET request
  $result=curl_exec($ch);
  $info=curl_getinfo($ch);
  curl_close($ch);

  return $result;
       }

 
 private function Request($url,$params=false,$type=HTTP_GET){
  
  // Populate data for the GET request
  if($type == HTTP_GET) $url = $this->MakeUrl($url,$params);
                 $result = file_get_contents($url, false, null);
  
  return $result;
        }

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。