I'm trying to get a script working with the Dynadot API, but when I do a domain name search here's what I get:
[i]
[function.file-get-contents]: failed to open stream: No such file or directory in /home/xyz/public_html/dynadotdomainsearch.php on line 10[/i]
The line of code referred to above is as follows:
[b]$answer = file_get_contents("https://www.dynadot.com/api.html?
version=1.0&key=".$key."&command=search&domain0=mydomain.net");[/b]
I made sure that my key and the command line itself works properly by entering it directly into my browser address line. Doing it that way, I get back the proper response. I just can't get it programmatically. I also made sure that I my IP addy was correct in my Dynadot API panel, and that this function is supported on my server, by testing the same code like so:
[color=#3333FF]$answer = file_get_contents("http://www.google.com");
echo $answer;[/color]
^ This works fine, so now I'm stumped. Any ideas?
Thanks,
Rick
[This post has been edited by kewlceo on Jul 20, 2007 8:24am.]
Thank you, Kate!
[color=#3333FF]
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.dynadot.com/api.html?version=1.0&key=".$key."&command=search&domain0=mydomain.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
[/color]
Best,
Rick
[This post has been edited by kewlceo on Jul 20, 2007 2:23pm.]
Suggestion... kewlceo... change your code from
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.dynadot.com/api.html?version=1.0&key=".$key."&command=search&domain0=mydomain.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
to
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.dynadot.com/api.html?version=1.0&key=".$key."&command=search&domain0=mydomain.com");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$return = curl_exec($ch);
curl_close($ch);
The reason for the change is that when you run curl_exec now it will return the page a string rather than trying to output it automatically allowing you to play around with it more and to customize it.
Dynadot API question