Home arrow PHP arrow Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5

Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5

In this second article of the series dealing with the implementation of some of the most useful web services offered by Yahoo! with PHP 5, Iíll show you how to parse the results returned by a determined web search service using a few array PHP processing functions.

TABLE OF CONTENTS:
  1. Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5
  2. Displaying web services search results in XML format
  3. Next Example
  4. Serving outputs of Yahoo! Web services as serialized PHP arrays
  5. Iterating over array elements with PHP 5
By: Alejandro Gervasio
Rating: starstarstarstarstar / 1
January 15, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Many modern web sites use popular web services, such as image and video searches. Their correct implementation has proven to be very useful when it comes to attracting new visitors that are looking for a richer and more productive surfing experience.

However, as youíll possibly know, using a given web service in conjunction with a powerful server-side scripting language like PHP 5 can be quite challenging. This is particularly true if the web service must be implemented from scratch using WSDL (Web Service Description Language).

Fortunately, there are some frameworks available on the web that will let you easily use a determined web service without having to deal directly with data delivered in XML format. And thatís precisely the case with Yahoo! Web Search Services, which can be directly invoked within your own PHP applications by writing only a few lines of code.

Naturally, if you already went through the first article of the series, then youíll surely be very familiar with using these web services provided by Yahoo! straight from a simple PHP script. As youíll possibly recall, during that tutorial I built some illustrative hands-on examples aimed at demonstrating how to utilize Yahoo!ís Image and Video Search Services, among others, using only small pieces of PHP 5 code.

The results returned by these hands-on examples, after querying one of the aforementioned web services, always outputted in XML format. This can be rather intimidating for some PHP developers who want to implement those services within the context of their own applications.

Nevertheless, the good news is that all of the web services offered by Yahoo! permit the specification of an additional ďoutput=phpĒ parameter within the corresponding query string, which indicates that all of the results retrieved should be returned in the form of a serialized PHP array. Indeed, as you can see, this feature simplifies displaying the respective search results in a more readable format, since PHP has plenty of native functions aimed at processing array elements.

Now, having introduced the primary subject of this tutorial, letís learn how to fetch results returned by the different Yahoo! Search Web Services in the form of serialized PHP arrays. Letís get started!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- 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...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: