Location: PHPKode > scripts > Search results retriever > sample.php
<?php
/*
* Copyright (C) 2010 Pierre-Luc Germain (plger)
* See class.httpRetriever.php for more information.
*

 THE DIFFERENT TYPES OF RETRIEVERS ARE:
createHttpRequest("amazon");
createHttpRequest("jstor");		// jStor.org
createHttpRequest("pubmed");	// PubMed publications (Entrez)
createHttpRequest("google");	// google (web,books,images,patents)
createHttpRequest("geocode");	// get coordinates (latitude/longitude) 
 									from google maps geocode service

 FOR ANY TYPE OF RETRIEVER, USE $retriever->help() TO DISPLAY SPECIFIC EXAMPLES...
$retriever = createHttpRequest("google");
$retriever->help();

 FOR AMAZON, YOU WILL NEED AN API KEY
$retriever = createHttpRequest("amazon");
$retriever->public_key = "Your Access Key ID";
$retriever->private_key = "Your Secret Access Key";
$retriever->setParam("Title", "Le petit prince");
$result_array = $retriever->fetch_results('array');

 IF YOU DON'T KNOW WHAT'S THE QUERY PARAMETER, YOU CAN USE STANDARDIZED FUNCTIONS:
$retriever->setQueryParam($value);

 IF YOU ARE QUERYING DIFFERENT SITES AND PUTTING EVERYTHING TOGETHER,
 YOU MIGHT WANT TO HAVE A STANDARDIZED OUTPUT:
$retriever = createHttpRequest("amazon");
$retriever->setQueryParam($value);
$result_array = $retriever->fetch_results();
$results = $retriever->standardize($result_array);

 IF YOU HAVE PROBLEMS, USE THE $retriever->getLog() TO DEBUG

*/

require 'class.httpRetriever.php';

// Sample usage (pubmed) :
$retriever = createHttpRequest("pubmed");
$retriever->setParam("term", "melanoma");
$retriever->fetch_results('display');

Return current item: Search results retriever