Home arrow PHP arrow Building a Form to Count Back Links Using Yahoo Inbound Links API

Building a Form to Count Back Links Using Yahoo Inbound Links API

In the first part of this three-part series, you learned the guiding concepts and design for building a PHP web application to count back links from unique domains using the Yahoo Site Explorer API. In this part, we will illustrate, in detail, how to do the programming for the PHP Ajax web form and the validation script.

TABLE OF CONTENTS:
  1. Building a Form to Count Back Links Using Yahoo Inbound Links API
  2. AJAX and variables for web form
  3. PHP Script Preliminary Form Processing
  4. Validating the Root Domain Name URL using PHP
By: Codex-M
Rating: starstarstarstarstar / 7
January 25, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

At the end of the third part, I'll give you a link which you can use to download all the files associated with this web application project.

Passing form variables to PHP via AJAX

The script uses captcha code that will pass the answer for the challenge using a PHP session, so at the top of the web form (file name: countuniquelinks.php), this code is placed:

<?php

session_start();

?>

Discussion of captcha generation is out of the scope of this article. However, you can read another article on this site for a detailed discussion of how to build a captcha system.  

Shown below this HTML web form screen shot is the source code required to produce the form.


<h3>This tool will count the number of back links coming from unique domains.</h3>

Please fill in required data and click "Submit" button.<br />

<br /><br />

<form action="/countuniquelinks/yahooapiajax.php" method="post" onsubmit="return false;">

Enter root domain URL ( for example: <a href="http://www.php-developer.org"><b>http://www.php-developer.org</b></a>). URL <b>should</b> start <i>http://</i> and <b>DO NOT include trailing slash at the end.</b><br />

<br />

<input style="background-color: #FFFFC0" type="text" name="domainurl" id="domainurl" size="50">

<br /><br />

Select whether to get unique backlinks to the entire domain or only to the homepage URL<br />

<input type="radio" name="options" id="options1" value="1" > Entire Site


<br />


<input type="radio" name="options" id="options2" value="2" > Only to the homepage URL


<br /><br />


<img src="/countuniquelinks/captcha.php" />


<br />


Enter the Captcha as shown above:


<br /> <br />


<input style="background-color: #FFFFC0" type="text" name="captcha" id="captcha" size="10">


<br /> <br />


<input type="submit" value="Submit" onClick="sendRequest()">


</form>


<br />


<a href="/countuniquelinks/countuniquelinks.php"><b>RESET FORM</b></a>


<br /><br />


RESULTS WILL BE SHOWN BELOW after pressing the submit button:


<br />


<br />


</font>




 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap

Dev Shed Tutorial Topics: