Database Articles

  Home arrow Database Articles arrow Page 15 - Creating a Search Application
DATABASE ARTICLES

Creating a Search Application
By: Matt Wade
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 16
    2003-07-15

    Table of Contents:
  • Creating a Search Application
  • Database Usage
  • Creating a Search Application
  • Searching
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Creating a Search Application -


    (Page 15 of 29 )

    In this function we will take care of obtaining the source from a URL. We will open a connection to the URL with the fopen() function and then read up to 25,000 bytes of the source with the fread() function. Once we have obtained the source from the URL, we will run it through the strip_tags() function to remove any HTML tags. We will also replace any   entities with a literal space character. This is so we can split the words on spaces later on.

    If we are unable to open a connection to the URL, the function will return FALSE, otherwise it will return the source.

    <?php
    function _getData($url) {
        
    $filehandle = @fopen($url'r');
        if(!
    $filehandle) {
            echo 
    "Could not open URL ($url).&lt;br /&gt;\n";
            
    $return FALSE;
        } else {
            
    $data fread($filehandle25000);
            
    fclose($filehandle);
            
    $data strip_tags ($data);
            
    $data str_replace('&amp;nbsp;'' '$data);
            
    $return $data;
        }
        return 
    $return;
    }
    ?>

    More Database Articles Articles
    More By Matt Wade

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


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