如何获取cURL响应参数?

时间:2016-10-18 16:27:24

标签: php curl

我对cURL非常陌生,所以我需要一些基本的帮助。

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL            => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HEADER         => true,
    CURLOPT_PRIVATE        => true,
));

$result = curl_exec($curl);

结果我收到数组: 数组(大小= 27)

'url' => string 'http://www.example.com/' (length=23)
  'content_type' => string 'text/html; charset=UTF-8' (length=24)
  'http_code' => int 200
  'header_size' => int 578
  'request_size' => int 54
  'filetime' => int -1
  'ssl_verify_result' => int 0
  'redirect_count' => int 0
  'total_time' => float 2.488353
  'namelookup_time' => float 2.3E-5
  'connect_time' => float 2.3E-5
  'pretransfer_time' => float 4.1E-5
  'size_upload' => float 0
  'size_download' => float 349651
  'speed_download' => float 140515
  'speed_upload' => float 0
  'download_content_length' => float 349651
  'upload_content_length' => float 0
  'starttransfer_time' => float 0.552837
  'redirect_time' => float 0
  'redirect_url' => string '' (length=0)
  'primary_ip' => string '1.11.11.111' (length=11)
  'certinfo' => 
    array (size=0)
      empty
  'primary_port' => int 80

问题是当我上http://www.example.com时,我自动转移到http://www.example.com/param1=EP2AED6AEBqAID;sid=5aaca7ddb04eb5d;

问题是,我应该如何获得这些参数?

0 个答案:

没有答案