{"id":1318,"date":"2018-01-19T19:22:42","date_gmt":"2018-01-19T19:22:42","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/php-scripts-for-interacting-with-networks-page-2\/"},"modified":"2018-01-19T19:24:41","modified_gmt":"2018-01-19T19:24:41","slug":"php-scripts-for-interacting-with-networks-page-2","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/php-scripts-for-interacting-with-networks-page-2\/","title":{"rendered":"PHP Scripts for Interacting with Networks Page 2"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Leidago Noabeb<\/div>\n<div class=\"\">on December 14, 2010<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<h2>Getting Information About a Domain Name with PHP<\/h2>\n<div class=\"articlePara\">When looking at a domain name as part of an email address or URL, you simply do not get enough information from it. You can even go so far as visiting that URL and you still will not have enough information about the ownership of that particular domain. Most of the kind of information that you would want will be located in a <em>WHOIS<\/em> database. These databases are maintained by registrars and can provide information about the owners of a particular domain. To get the information from these databases, you need to run a <code>whois<\/code> query from a client application. PHP provides this kind of client application through the PEAR package.<\/div>\n<div class=\"articlePara\">PEAR has a class called Net_Whois that enables you to query a whois database. You use it like so:<\/div>\n<div class=\"example\"><code><\/p>\n<pre>&lt;!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" <br\/>    \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\"&gt;\n&lt;html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"&gt;\n&lt;head&gt;\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=iso-8859-1\" \/&gt;\n&lt;title&gt;Untitled Document&lt;\/title&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n&lt;? \nrequire_once \"Net\/Whois.php\";\n$server = \"whois.networksolutions.com\";\n$query = \"metroworks.com\";\n$whois = new Net_Whois;\n$urlinfo = $whois-&gt;query($query, $server);\nvar_dump($urlinfo);\n?&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p><\/code><\/div>\n<div class=\"articlePara\">First, the code defines the server where the whois database is located:<\/div>\n<div class=\"example\"><code><\/p>\n<pre>$server = \"whois.networksolutions.com\";<\/pre>\n<p><\/code><\/div>\n<div class=\"articlePara\">Then it defines the name of the domain that it wants to run a query on:<\/div>\n<div class=\"example\"><code><\/p>\n<pre>$query = \"metroworks.com\";<\/pre>\n<p><\/code><\/div>\n<div class=\"articlePara\">Finally, the query is run, after the Net_whois class is instantiated:<\/div>\n<div class=\"example\"><code><\/p>\n<pre>$whois = new Net_Whois;\n$urlinfo = $whois-&gt;query($query, $server);<\/pre>\n<p><\/code><\/div>\n<div class=\"articlePara\">And the information from the query is shown:<\/div>\n<div class=\"example\"><code><\/p>\n<pre>var_dump($urlinfo);<\/pre>\n<p><\/code><\/div>\n<div class=\"articlePara\">The <code>var_dump()<\/code> function will show the entire contents of the <code>$urlinfo<\/code> variable.<\/div>\n<h2>Download the Code<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<li><a href=\"NetworkingSourceCode.html\"><strong>NetworkingSourceCode.zip<\/strong><\/a><\/li>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"Leidago_Noabeb12142010.html\">\u00ab Previous Page<\/a><\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"Leidago_Noabeb12142010.html\">1<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">2<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Use these PHP tools and functions to make your PHP scripts more useful in a network<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1318","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1318"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1318\/revisions"}],"predecessor-version":[{"id":3206,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1318\/revisions\/3206"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}