Hello Daniweb,
I was wondering how come a cURL API I made to call a function from my other website (but on the same hosting plan) no longer works.
I even tried making a test API to call in the same directory, eg...
:api.php
<?php die(json_encode("something")); ?>
:testing.php
<?php
$url = "http://mywebsite.com/api.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
if ($result === false) {
echo "_error_".curl_error($ch);
} else if ($result == "1") {
echo "success";
} else {
echo $result;
}
curl_close($ch);
?>
However it's really weird, if I try that same script from testing.php but on another website that is on a different host it works fine, and vice-versa.
It just no longer works when I try to call from one site to the other which are both on my same host.