Answers for "print status code curl"

PHP
2

php curl print status

$url = 'http://www.example.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, true);    // we want headers
curl_setopt($ch, CURLOPT_NOBODY, true);    // we don't need body
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
$output = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo 'HTTP code: ' . $httpcode;
Posted by: Guest on March-02-2020
1

get status code of curl

curl -o /dev/null -s -w "%{http_code}\n" http://localhost
Posted by: Guest on January-15-2021
1

curl get return code

curl -I http://www.example.org
Posted by: Guest on March-18-2021

Browse Popular Code Answers by Language