Location: PHPKode > scripts > DCHK > dchk/doc.html
<h1>DCHK PHP class - v1.0</h1>
<h2>What the class does - Main features</h2>
<p>
	<ul>
		<li>Checks if a domain name is available</li>
		<li>Perersonalized server to check domain avaiability</li>
		<li>Links to a registrar (if the domain is free)</li>
		<li>Optionally outputs the result of the test</li>
	</ul>
</p>

<h2>Functions in the class</h2>
<h3>check_domain</h3>
<p>
	<code>
		function check_domain($domain, $server = $this->server, $port = $this->port, $print = 0)
		<br /><br />
		@param string $domain the domain to check<br />
      @param string $server the server used for the checking<br />
	   @param int      $port the port needed to reach the server<br />
	   @param bool   $print set to 1 if you want the outputs printed<br />
      @return bool returns true if the domain is available, false otherwise<br />
	</code>
	<br />
	Checks the domain avaiability and, if set, prints the result.
</p>

<h2>Examples of use</h2>
<h3>Example #1</h3>
<p>
	The following code will check for the domain name example.com and, if available,	will return the link to the registration through 1and1.com You can change the server used to check domains availability and the site from where buy the domain name by specifing them in the method call.
	<br /><br />
	<code>
	include_once('dchk.php');<br /><br />
	
	$free = new DCHK();<br />
	if($free->check_domain("example.com"))<br />
		// domain available<br />
	else<br />
		// Domain already registered!<br />
	</code>
</p>

<h3>Example #2</h3>
<p>
Form to check domain names
<br /><br />
<code>
<?php<br />
if (isset($_POST['submit'])) {<br />
	$domain = $_POST['domain'];<br />
	$ext = $_POST['extension'];<br />
	$full_name = $domain . '.' . $ext;<br /><br />

	include_once('dchk.php');<br /><br />

	$free = new DCHK();<br />
	if($free->check_domain("example.com, , , 1")) // Prints the register link also<br />
} else {<br />
?>	<br />
	<form method="post">
		Check for a domain name:
		<input type="text" name="domain" />
		<select name="extension">
			<option value="com">.com</option>
			<option value="org">.net</option>
			<option value="net">.org</option>
			<option value="biz">.biz</option>
		</select>
		<br />
		<input type="submit" name ="submit" value="Check now!"/>
	</form>
<?<br />
}<br />
</p>


<h2>Changelog</h2>
<p>
	No changes made since now.
</p>

<h2>License</h2>
<p>
	Copyright (C)2007 Giulio Bai <hide@address.com>
</p>

<p>
	<blockquote>
		This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation.
		<br /><br />
		This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
		<br /><br />
		You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</blockquote>
</p>

<p>
	A copy of the full license can be found in the <a href="http://www.gnu.org/licenses/gpl.html">official GNU's site</a>
</p>

<h2>Notes</h2>
<p>
	<h3>Links</h3>
	<ul>
		<li><a href="http://hewle.com">http://hewle.com</a> - My site :)</li>
		<li><a href="http://www.phpclasses.org">http://www.phpclasses.org</a> - Lots and lots of PHP classes</li>
		<li><a href="http://www.php.net">http://www.php.net</a> - PHP official site</li>
	</ul>
	
	<h3>Plase share it!</h3>
	<p>
		If you found this program useful, share it! Maybe it can help also other people!<br />
		Don't be scared, it's free, editable, redistributable.<br />
		So... share, Share, SHARE!	
	</p>
	
	<h3>Contacts</h3>
	<p>
		If you want to know more about this program, you can contact me at <a href="mailto:hide@address.com">hide@address.com</a>.<br />
		Wht do you think about this program? Is it useful? How can be improved?	
	</p>
</p>
Return current item: DCHK