6.3. Requesting Multiple Domains

Zend_HttpClient supports sending requests to multiple domains by setting the URL to query using Zend_HttpClient::setUri().

[Note] Note

A great use for this is when querying multiple RSS feeds.

Example 6.4. Requesting Multiple Domains

<?php
require_once 'Zend/HttpClient.php';

// Instantiate our client object
$http = new Zend_HttpClient();

// Set the URI to Slashdot's main feed
$http->setUri('http://rss.slashdot.org/Slashdot/slashdot');

// Retrieve the feed
$slashdot = $http->get();

// Now get the BBC news feed
$http->setUri('http://newsrss.bbc.co.uk/rss/newsonline_world_edition/technology/rss.xml');

// Retrieve the feed
$bbc = $http->get();
?>