I have a curl request, it working fine in my localhost, I have uploaded it to server but it hangs and end with error 500 internal server error. If remove the line echo $output = curl_exec($ch); It works fine.
$url = "https://someserver.com/api/";
$username = "some_user";
$password = "some_apss";
if(!extension_loaded('curl')){
die("Curl extension not loaded");
}
if(!function_exists('curl_init')){
die("curl_init not found");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
echo $output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);`
echo $output = curl_exec($ch);part, because the request is not executed anymore. check the server you are making the request to in a browser and see if it works$output = curl_exec($ch); echo $output