php - Curl - Retrive headers - empty response -


using php when working curl.

i'm attempting recive headers.

i request following url: http://halens.se/kvinna-klader-bad-strand-baddrakter-93/baddrakt-074209/

my settings this:

  curlopt_autoreferer     => true,   curlopt_certinfo        => false,   curlopt_crlf            => true,   curlopt_connecttimeout  => 15,   curlopt_failonerror     => true,   curlopt_followlocation  => true,   curlopt_forbid_reuse    => true,   curlopt_fresh_connect   => true,   curlopt_header          => true,   curlopt_maxredirs       => 15,   curlopt_protocols       => curlproto_http,   curlopt_redir_protocols => curlproto_http,   curlopt_returntransfer  => true,   curlopt_ssl_verifypeer  => false,   curlopt_timeout         => 15,   curlopt_header          => true,   curlopt_nobody          => true 

but response empty.. what did wrong? or how can solve in alternative way?


if instead change last setting to:

  curlopt_nobody          => false 

then headers:

http/1.1 301 moved permanently content-length: 199 content-type: text/html; charset=utf-8 location: http://www.halens.se/kvinna-klader-bad-strand-baddrakter-93/baddrakt-074209/ server: microsoft-iis/7.5 x-powered-by: arr/2.5 x-powered-by: asp.net date: sun, 06 oct 2013 19:26:31 gmt  http/1.1 200 ok cache-control: private content-length: 123009 content-type: text/html; charset=utf-8 server: microsoft-iis/7.5 set-cookie: asp.net_sessionid=wsp1hsdq1huvdnmr0jf42m1o; path=/; httponly set-cookie: asp.net_sessionid=wsp1hsdq1huvdnmr0jf42m1o; path=/; httponly set-cookie: favoritelist=id=593cd25e-3508-46a8-9596-66bd45caa335&hash=prhtfwrfdx; expires=sat, 04-jan-2014 20:26:32 gmt; path=/ set-cookie: interactorid=wsp1hsdq1huvdnmr0jf42m1o_162_13_85_148; path=/ set-cookie: clicktrail=074209; expires=thu, 05-dec-2013 20:26:32 gmt; path=/ x-powered-by: arr/2.5 x-powered-by: asp.net date: sun, 06 oct 2013 19:26:32 gmt 

not answer specific : seems little bit weird , googling around can see other people have struggling issue (without getting closer explanation) - aware of get_headers function?

$header = get_headers('http://halens.se/kvinna-klader-bad-strand-baddrakter-93/baddrakt-074209/'); echo '<pre>'; print_r($header); echo '</pre>'; 

outputs

array (     [0] => http/1.1 301 moved permanently     [1] => content-length: 199     [2] => content-type: text/html; charset=utf-8     [3] => location: http://www.halens.se/kvinna-klader-bad-strand-baddrakter-93/baddrakt-074209/     [4] => server: microsoft-iis/7.5     [5] => x-powered-by: arr/2.5     [6] => x-powered-by: asp.net     [7] => date: sun, 06 oct 2013 21:17:44 gmt     [8] => connection: close     [9] => http/1.1 200 ok     [10] => cache-control: private     [11] => content-length: 123078     [12] => content-type: text/html; charset=utf-8     [13] => server: microsoft-iis/7.5     [14] => set-cookie: asp.net_sessionid=i5nrsl55e1shp4alanw3dlzu; path=/; httponly     [15] => set-cookie: asp.net_sessionid=i5nrsl55e1shp4alanw3dlzu; path=/; httponly     [16] => set-cookie: favoritelist=id=51b514b9-21e8-4ed3-9ec9-38ef8a2df113&hash=vkszpiufzx; expires=sat, 04-jan-2014 22:17:44 gmt; path=/     [17] => set-cookie: interactorid=i5nrsl55e1shp4alanw3dlzu_80_163_1_60; path=/     [18] => set-cookie: clicktrail=074209; expires=thu, 05-dec-2013 22:17:44 gmt; path=/     [19] => x-powered-by: arr/2.5     [20] => x-powered-by: asp.net     [21] => date: sun, 06 oct 2013 21:17:44 gmt     [22] => connection: close ) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -