I'm assuming the cURL handle is valid since I am checking the return value from curl_init() and it is not equal to FALSE.
Here is my code:
if ( ($ch = curl_init()) === FALSE ) trigger_error("Could not initialize cURL session.", E_USER_ERROR);
// Set the URL to fetch. if ( !curl_setopt($ch, CURLOPT_URL, $events_list_URL) ) trigger_error("Could not set CURLOPT_URL.", E_USER_ERROR);
// Return the transfer as a string instead of directly outputting it. if ( !curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE) ) trigger_error("Could not set CURLOPT_RETURNTRANSFER.", E_USER_ERROR);
// Execute a cURL session. It should return a list of events encoded in JSON. $json = curl_exec($ch); if ( $json === FALSE ) trigger_error("curl_exec failed.", E_USER_ERROR);
Yes, I did turn on the curl extension and I verified that it is enabled by displaying the localhost page (its listed under enabled extensions).
I did some research on the internet and found one gentleman who was using a configuration similar to mine (Wampserver version 2.1 (64-bit). The PHP version is 5.3.4. using WIndows 7) His curl_exec was also failing. He went to the trouble of installing a sniffer program. He fixed the problem by doing the following:
"I just added the "KeepAliveTime" setting with windows 7 regedit.exe in HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/Tcpip, as a REG_DWORD value, set it to decimal 25000 (so 25 seconds), rebooted, and it all works as i want it now.."
I'm not technical enough to understand his solution. I'm currently investigating it.