I can’t figure out what I’m doing wrong here. The code block is intended to take the URL contained in $url, send a HEAD request and then print the header that comes back.
For this test, I set $url=“http://www.google.com”.
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST,“HEAD”);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_exec only returns true - even though it should return the entire contents since I set RETURNTRANSFER to 1.