0
$your_url = "https://consumablesandstores.com/";
//$your_url = "https://www.sancuro.com/";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $your_url);
curl_setopt($ch, CURLOPT_FAILONERROR, true); // Required for HTTP error codes to be reported via our call to curl_error($ch)
curl_exec($ch);
if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
}
curl_close($ch);

if (isset($error_msg)) {
}

we have to check our live site to open using curl but it's showing blank.Another site is open please give me solution what is exact issue? How to resolve?

Devidas
  • 181
  • 1
  • 11

1 Answers1

0

if you modify your code like this:

if (isset($error_msg)) {echo $error_msg;}

it will show you the error:

The requested URL returned error: 401 Unauthorized

You might need to provide authorization details, i.e.

curl_setopt($ch, CURLOPT_USERPWD,"myusername:mypassword");
Boggers
  • 27
  • 5