Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #21517

curl amazon.de da errore invece di http_status 200

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Sandro kensan <kensan@kensan.it>
Newsgroups it.comp.www.php
Subject curl amazon.de da errore invece di http_status 200
Date Tue, 21 Mar 2017 23:30:06 +0100
Lines 33
Message-ID <ejdnrgF8gd4U1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace individual.net cVfUeGkGZiTu2b6SUPTnyg2KuufqLnwOVi7B5iu1UdyGfcZ7Qz
Cancel-Lock sha1:6K3mbU4zl3xjyQE0NVk6Q4+bxnY=
X-Mozilla-News-Host snews://news.individual.net:563
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACdQTFRF ////e3t7c5Rrc4xrc4Rza6Vaa5xja5RjY8ZCY7VKY61SWtY5Ws5COHDUbwAAASBJREFUOMt1071u gzAQAGC/wsmlSgRL50yZO2WM1CVjRRaGTH2KzJky8xQWIap1XjLzUjnzE+K7wxIS8Mnn+wGDYh0g LsNftwA6XHUIFehwAx3usABuAWJGWe0PAuIJf2PGhkXKp4gqtByoOERPNw8G9Ixhm/dbeajaA3xj o53h6GolZD14pcB9pcDQko9OQhOh6JvJ2k5iLzLdeMypRhWQt8QfWQ5mnqgt3z8U8/bJTHKdoHnN 8/P4mrtJJw22mmfeB7LAlhk2/GC7FfAYBhp2HCiJzTi/FCpYzx1MIcfw22GQUFAC6zTtKZQDK+EM UFIGpQB6XtE2CUNzMhkKv8ZJC/iPNZcKxNJWvHSj/oApuAWQ3VU3zHAGHe6gg+Pv4QkKmdrgO+XA 0gAAAABJRU5ErkJggg==
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
Xref csiph.com it.comp.www.php:21517

Show key headers only | View raw


Alcune pagine web se aperte da browser danno un http status di 200
mentre se aperte da curl danno errore oppure un 5xx.

Per esempio https://www.amazon.de/dp/3864451434 non da 200 con il
seguente curl:

function httpstatus($link){
	$handle = curl_init($link);
	curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
	curl_setopt($handle, CURLOPT_NOBODY, TRUE);
	curl_setopt($handle, CURLOPT_FOLLOWLOCATION, TRUE);
	curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 4);
	curl_setopt($handle, CURLOPT_TIMEOUT, 10);
	curl_setopt($handle, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux
x86_64; rv:45.0) Gecko/20100101 Firefox/45.0");

	$response = curl_exec($handle);
	if ($response === false) {
		$httpCode = "error";
	}else{
		$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
	}

	curl_close($handle);
	return($httpCode);
}

Qualche idea per migliorare il codice?

-- 
Sandro kensan www.kensan.it & www.qiqi.it geek site
Saluto gli agenti della NSA - Hello NSA - www.nsa.gov

Back to it.comp.www.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-21 23:30 +0100
  Re: curl amazon.de da errore invece di http_status 200 Leonardo Serni <lserni@gmail.com> - 2017-03-22 00:17 +0100
    Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-22 13:14 +0100
      Re: curl amazon.de da errore invece di http_status 200 Leonardo Serni <lserni@gmail.com> - 2017-03-22 22:53 +0100
        Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-23 10:17 +0100
        Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-29 15:22 +0200
          Re: curl amazon.de da errore invece di http_status 200 fmigliori <fmigliori@gmail.com> - 2017-03-29 09:39 -0700
            Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-29 20:17 +0200
            Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-29 21:59 +0200
              Re: curl amazon.de da errore invece di http_status 200 fmigliori <fmigliori@gmail.com> - 2017-03-29 13:18 -0700
              Re: curl amazon.de da errore invece di http_status 200 fmassei@gmail.com - 2017-03-29 14:13 -0700
          Re: curl amazon.de da errore invece di http_status 200 Leonardo Serni <lserni@gmail.com> - 2017-03-29 23:02 +0200
            Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-30 15:04 +0200
              Re: curl amazon.de da errore invece di http_status 200 Leonardo Serni <lserni@gmail.com> - 2017-03-30 20:10 +0200
                Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-30 23:54 +0200
  Re: curl amazon.de da errore invece di http_status 200 fmassei@gmail.com - 2017-03-21 16:31 -0700
    Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-22 13:21 +0100
      Re: curl amazon.de da errore invece di http_status 200 fmassei@gmail.com - 2017-03-22 07:33 -0700
        Re: curl amazon.de da errore invece di http_status 200 Sandro kensan <kensan@kensan.it> - 2017-03-23 10:18 +0100

csiph-web