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...

<?php die(json_encode("something")); ?>


    $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;


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.

Edited by joshl_1995

2 Years
Discussion Span
Last Post by joshl_1995

Assuming the host it is trying to connect to is external to the local network, or is in another subnet, then either the internet proxy or the router (depending upon situation) will need to be reconfigured. You need to have your hosting provider deal with this.

Edited by rubberman

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.