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.

Recommended Answers

Hi, what's the result of curl_error()?

Jump to Post

All 4 Replies

Hi, what's the result of curl_error()?

It says "Failed to connect to {DOMAIN} port 80"

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.

Ok thanks, I just thought I'd see what people here on Daniweb have to say first before I contact GoDaddy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.