Hello StackOverflow community, I've encountered a problem when I try to use cURL methods on PHP. I tried with this sample code:
$html_brand = "www.google.com/";
$ch = curl_init();
$options = array(
CURLOPT_URL => $html_brand,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_HTTPHEADER => array("User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"),
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_ENCODING => "",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
);
curl_setopt_array( $ch, $options );
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ( $httpCode != 200 ){
echo "Return code is {$httpCode} \n"
.curl_error($ch);
} else {
echo "<pre>".htmlspecialchars($response)."</pre>";
}
curl_close($ch);
And it always ends with an error, displaying it on screen:
Return code is 0 Recv failure: Connection was reset
Or this error, when trying to reach any site with https:
Return code is 0 Failed to connect to www.google.com port 443: Timed out
This are my settings:
- Windows 7 Professional 32 bit
- Apache 2.4.12
- PHP 5.6.11
Is it a code error or any server configurations I have not considered?
The HTTP_HOST value in Apache is localhost:8080, which I'm not really sure if it has anything to do with my problem, but maybe it's worth noting.
Thank all of you in advance.

CURLOPT_HTTPHEADER, but they did not make any difference. I used it as a sample in this question because it seems to be the most coherent, complete and simple test code that I have found in the last few hours, and it would be nice to make it work for further coding on my own.