예제 #1
0
 public static function post($url, $postFields = [], $decode = true)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, Utils::ensureArray($postFields));
     return self::request($ch, $url, $decode);
 }
예제 #2
0
 public static function convertArrayToQueryString($params = [])
 {
     $qs = '';
     $params = Utils::ensureArray($params);
     $counter = 0;
     foreach ($params as $key => $value) {
         $qs .= $counter === 0 ? '?' : '&';
         $qs .= $key . '=' . $value;
         ++$counter;
     }
     return $qs;
 }