Question

PHP cUrl is displaying a web page insted server not found.

Posted December 24, 2014 3.4k views

Can you understand this PHP program>>

<?php
function file_get_contents_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

echo file_get_contents_curl('http:// 5w43242423424v2ic.com');
?>

This program Should be echo ‘default server not found’ instead a web page.

digitalocean server is displaying a website page when i access this domain 'http:// 5w43242423424v2ic.com’ via your server.

Because this domain is not available and registered.

2 comments
  • What DNS resolvers are you using? Can you post the contents of /etc/resolv.conf?

  • Yes i solved this issues.

    You can add “search domain.tld” line to the file /etc/resolvconf/resolv.conf.d/head
    which is used to generate the resolv.conf file on the system during reboot.
    AFTER that reboot droplet.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

This question was answered by @RinkuY:

Yes i solved this issues.

You can add “search domain.tld” line to the file /etc/resolvconf/resolv.conf.d/head
which is used to generate the resolv.conf file on the system during reboot.
AFTER that reboot droplet.

View the original comment

Submit an Answer