I am deploying my Laravel application to shared hosting from Godaddy for testing purposes only (so that I can share it in a domain) for production I will be using a better solution.
In my localhost, everything works fine, but in hosting CURL is not working. Actually, this CURL
function setUrl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, public_path().'/cookies/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, public_path().'/cookies/cookies.txt');
$buffer = curl_exec($ch);
curl_close($ch);
return $buffer;
}
This does not work. When I check my cookies.txt file in the hosting it is always empty, actually I tried moving it to public, another folder and everywhere, but it does not get edited, it is always empty. It worked fine in my localhost, but for some reason it doesn't want to work in hosting.
Does anyone have some idea to tackle this issue?
This I my curinfo if it helps
"content_type" => null
"http_code" => 0
"header_size" => 0
"request_size" => 0
"filetime" => -1
"ssl_verify_result" => 0
"redirect_count" => 0
"total_time" => 0.200232
"namelookup_time" => 4.8E-5
"connect_time" => 0.0
"pretransfer_time" => 0.0
"size_upload" => 0.0
"size_download" => 0.0
"speed_download" => 0.0
"speed_upload" => 0.0
"download_content_length" => -1.0
"upload_content_length" => -1.0
"starttransfer_time" => 0.0
"redirect_time" => 0.0
"redirect_url" => ""
"primary_ip" => ""
"certinfo" => []
"primary_port" => 0
"local_ip" => ""
"local_port" => 0
]
echo phpinfo();in a separate file and check whether curl is enabled on a server or not. If not then contact the support team.