PHP
  Home arrow PHP arrow Page 3 - Using Yahoo Web Services to Perform Searches with an Object-Oriented Approach
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Using Yahoo Web Services to Perform Searches with an Object-Oriented Approach
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2008-02-12


    Table of Contents:
  • Using Yahoo Web Services to Perform Searches with an Object-Oriented Approach
  • Building a web search class with PHP 5
  • Testing the previous “WebSearchService” class
  • Building a video searching class with PHP 5

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Using Yahoo Web Services to Perform Searches with an Object-Oriented Approach - Testing the previous “WebSearchService” class
    ( Page 3 of 4 )

    If you’re anything like me, then you may want to see how the previously defined “WebSearchService” class can work under real conditions. Therefore, below I set up a concrete example that shows how the class in question returns 15 different entries associated with the string “Devshed.com” to client code, naturally fetched by the respective Yahoo! Web Search Service.

    Here’s the corresponding code sample, along with the pertinent list of results:


    try{

    // create new instance of 'WebSearchService' class

    $ws=new WebSearchService();

    // set search query

    $ws->setQuery('Devshed.com');

    // set number of search results

    $ws->setNumResults(15);

    // display search results

    echo $ws->getSearchResults();

     

    }

    catch(Exception $e){

    echo $e->getMessage();

    exit();

    }


    // displays the following


    Open Source Web Development Tutorials - Dev Shed


    Offers a complete line of information on web page
    design tips, java scripting guide, shareware HTML
    editor, and web server software and setup.

    http://www.devshed.com/

    Webmaster Tools, Developer Tools, Programming Tools -
    Dev Mechanic


    Do you know who your target audience is? If you don't
    know, you are not ... When faced with diminishing sales
    or a shift in profitability, sometimes a ...

    http://tools.devshed.com/

    Web Hosting, Web Hosting Help, Web Hosting FAQs,
    Find Hosting - Web Hosting


    Web Hosting, Web Hosting Help, Web Hosting FAQs,
    Find Hosting - Web Hosting ... In this second part, I
    want to get more specific about the types of hosting ...

    http://webhosting.devshed.com/

    PHP Help, PHP Programming, PHP Code, PHP Tutorials


    A wide range of tutorials and articles with a growing
    PHP section. ... Formerly referred to as "Personal Home
    Page Tools," PHP Hypertext Preprocessor ...

    http://www.devshed.com/c/b/PHP/

    PHP Security Mistakes


    Email Me Similar Content When Posted. Add Developer
    Shed Article Feed To Your Site. Email Article To Friend.
    Print Version Of Article. PDF Version Of Article ...

    http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/

    Creating a Secure PHP Login Script


    Email Me Similar Content When Posted. Add Developer
    Shed Article Feed To Your Site. Email Article To Friend. Print
    Version Of Article. PDF Version Of Article ...

    http://www.devshed.com/c/a/PHP/
    Creating-a-Secure-PHP-Login-Script/

    MySQL Help, MySQL Tutorials, MySQL Programming, MySQL
    Tricks


    A collection of MySQL tutorials on Administration, and
    Grant Tables. ... MySQL is an open source relational
    database management system (RDBMS) ...

    http://www.devshed.com/c/b/MySQL/

    Linux Web Hosting


    Find your next Linux Web Host now! Search through
    our highly recommended Linux Web Hosting companies
    and read our Web Hosting FAQs and Web Hosting articles
    to help ...

    http://www.devshed.com/linux-web-hosting

    Perl Help, Perl Programming, Perl Code, Perl Tutorials,
    Perl Development


    A five-part beginning perl series that covers topics from
    regular expressions to file manipulation to database
    access for web developers.

    http://www.devshed.com/c/b/Perl/

    Dedicated Servers


    Find your next Dedicated Servers Host now! Search
    through our highly recommended Dedicated Servers
    Hosting companies and read our Web Hosting FAQs
    and Web Hosting ...

    http://www.devshed.com/dedicated-servers

    Small Business Hosting


    Find your next Small Business Host now! Search through
    our highly recommended Small Business Hosting companies
    and read our Web Hosting FAQs and Web Hosting articles ...

    http://www.devshed.com/small-business-hosting

    Web Development Archives, Web Developer Archives, FAQs,
    Mailing Lists, Newsgroups


    Web Development archives, containing a multitude of
    information spanning FAQs, ... Here you will find an
    assortment of Mailing Lists such as Java Discussion,
    MySQL ...

    http://archives.devshed.com/

    E-Commerce Hosting


    Find your next E-commerce Web Host now! Search through
    our highly recommended E-commerce Web Hosting companies
    and read our Web Hosting FAQs and Web Hosting articles ...

    http://www.devshed.com/e-commerce-hosting

    High Performance Web Caching With Squid


    Article on tuning Squid on Linux for maximum performance
    and stability. ... Email Me Similar Content When Posted. Add
    Developer Shed Article Feed To Your Site ...

    http://www.devshed.com/c/a/Administration/High-
    Performance-Web-Caching-With-Squid/

    Database Programming in Python: Accessing MySQL


    Database Programming in Python: Accessing MySQL by
    A.P.Rajshekhar ... Email Me Similar Content When Posted.
    Add Developer Shed Article Feed To Your Site ...

    http://www.devshed.com/c/a/Python/
    Database-Programming-in-Python-Accessing-MySQL/


    See how easy it is to query the Yahoo! Web Search Service using the PHP class that I built before? I guess you do! In this case, this class comes in handy for hiding all the business logic required to implement this specific Yahoo! web service behind its API, and its use demands only a few lines of PHP 5 code.

    All in all, I showed you how to use a compact PHP class to query the Yahoo! Web Search Service and eventually return the corresponding results to client code. So, what is the next thing to do now?

    Well, due to the flexible nature of the class that you learned before, it’s possible to build a similar one that works with the Yahoo! Video Search Service instead, without having to completely modify its structure. Therefore, in the last section of this tutorial I’m going to show you how to build such a class. But as you might have guessed, to see the details of this process, you’ll have to click on the link below and keep reading.



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek