Exemplo n.º 1
0
 public function actionCurl()
 {
     $return = CURL::post("api.filmfest.com/site/test-post", "post=aaaa&hehe=bbbbxii");
     echo equal('{"post":"aaaa","hehe":"bbbbxii"}', $return, 'CURL::post');
     $data = CURL::get("api.filmfest.com/site/test-get?get=abcss");
     echo equal('{"get":"abcss"}', $data, 'CURL::get');
 }
Exemplo n.º 2
0
 public static function post($path, $data = [])
 {
     $query_arr = [];
     foreach ($data as $key => $value) {
         $query_arr[] = $key . '=' . $value;
     }
     $query_str = join('&', $query_arr);
     $url = self::$api_url . '/' . $path;
     return CURL::post($url, $query_str);
 }