set_request_url() 공개 메소드

Set the URL to make the request to.
public set_request_url ( string $url )
$url string (Required) The URL to make the request to.
예제 #1
0
 /**
  * 调用API
  * @param string $apiMethod api方法名
  * @param array || string  $params 请求参数
  * @param string $method HTTP请求类型
  * @param string $headers 附加的HTTP HEADER信息
  * @return string
  */
 private function _baseControl($apiMethod, $params, $method = 'GET', $headers = array())
 {
     $method = strtoupper($method);
     if (is_array($params)) {
         $params = http_build_query($params, '', '&');
     }
     $url = $this->_pcs_uri_prefixs['https'] . $apiMethod . ($method == 'GET' ? '&' . $params : '');
     $requestCore = new RequestCore();
     $requestCore->set_request_url($url);
     $requestCore->set_method($method);
     if ($method == 'POST') {
         $requestCore->set_body($params);
     }
     foreach ($headers as $key => $value) {
         $requestCore->add_header($key, $value);
     }
     $requestCore->send_request();
     $result = $requestCore->get_response_body();
     return $result;
 }