{"action":"created","issue":{"url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/9","labels_url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/9/comments","events_url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/9/events","html_url":"https://github.com/HelgeSverre/Domain-Availability/issues/9","id":56832225,"number":9,"title":"gethostbyname logic + example issues","user":{"login":"dbough","id":2511406,"avatar_url":"https://avatars.githubusercontent.com/u/2511406?v=3","gravatar_id":"","url":"https://api.github.com/users/dbough","html_url":"https://github.com/dbough","followers_url":"https://api.github.com/users/dbough/followers","following_url":"https://api.github.com/users/dbough/following{/other_user}","gists_url":"https://api.github.com/users/dbough/gists{/gist_id}","starred_url":"https://api.github.com/users/dbough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbough/subscriptions","organizations_url":"https://api.github.com/users/dbough/orgs","repos_url":"https://api.github.com/users/dbough/repos","events_url":"https://api.github.com/users/dbough/events{/privacy}","received_events_url":"https://api.github.com/users/dbough/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-06T16:19:02Z","updated_at":"2015-06-17T14:07:26Z","closed_at":null,"body":"Hi -\r\n\r\nOn ~line 418 in `AvailabilityScript.php` there is a check to determine if the domain name == the ipv4 address (as returned by `gethostbyname`).  This will always fail meaning `isAvaible` will always return false.  Not sure why this is being done?:\r\n\r\n    if (gethostbyname($domain) == $domain) { \r\n        $tld = $this->getTld($domain);\r\n\r\nAlso, the logic in the README for the example usage is wrong. This:\r\n\r\n    if ($available) { \r\n        echo $domain.\" is not registered\\n\";\r\n    } else {\r\n        echo $domain.\" is registered\\n\";\r\n    }\r\n\r\nShould probably be something like this:\r\n\r\n    if ($available === false) {\r\n        echo $domain.\" is not registered\\n\";\r\n    } else {\r\n        echo $domain.\" is registered\\n\";\r\n    }"},"comment":{"url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/comments/112815545","html_url":"https://github.com/HelgeSverre/Domain-Availability/issues/9#issuecomment-112815545","issue_url":"https://api.github.com/repos/HelgeSverre/Domain-Availability/issues/9","id":112815545,"user":{"login":"vitushoesl","id":12609156,"avatar_url":"https://avatars.githubusercontent.com/u/12609156?v=3","gravatar_id":"","url":"https://api.github.com/users/vitushoesl","html_url":"https://github.com/vitushoesl","followers_url":"https://api.github.com/users/vitushoesl/followers","following_url":"https://api.github.com/users/vitushoesl/following{/other_user}","gists_url":"https://api.github.com/users/vitushoesl/gists{/gist_id}","starred_url":"https://api.github.com/users/vitushoesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitushoesl/subscriptions","organizations_url":"https://api.github.com/users/vitushoesl/orgs","repos_url":"https://api.github.com/users/vitushoesl/repos","events_url":"https://api.github.com/users/vitushoesl/events{/privacy}","received_events_url":"https://api.github.com/users/vitushoesl/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T14:07:26Z","updated_at":"2015-06-17T14:07:26Z","body":"Another thing I've got trouble with what that - at least in my case - `gethostbyname()` returns the ip adress of itself if the domain is not available. I changed the first if condition (l.419) from\r\n\r\n```\r\nif (gethostbyname($domain) == $domain) {\r\n```\r\n\r\nto\r\n\r\n```\r\nif (gethostbyname($domain) == gethostbyname(gethostname())) {\r\n```\r\n\r\nIf the domain is in use, it usally returns the ip adress of the dns records. If it returns my own ip adress all the process with the whois information is done.\r\n\r\nWorks for me as well."}}