so this url: http://search.cnn.com/pages/search.jsp?query= is the base query URL. What you then do, is set in your own query term (url-encoded) and retrieve the info.
Now, the easiest way is with [man]file_get_contents/man
and then extract 5 "news items" from that.
Each search result takes the following form:
<tr><td valign=top width=10 class=cnnResults align=right><!-- RESULT NUMBER -->. </td>
<td valign=top class=cnnResults align=left>
<b><a href="http://cnn.com/2006/POLITICS/03/10/sr.fri/index.html"><!-- TITLE --></a></b>
<span class="resultsDate" style="color:#666666;"> <!-- DATE --></span>
<br><!-- DESCRIPTION --><br><br>
</tr></td>
SO from that you can write a simple regex, to get only results 1 - 5. Alternatively, you could use a loop, but it's not necessary if you want a fixed number.
The regex would look something like:
<tr><td valign=top width=10 class=cnnResults align=right>([1|2|3|4|5]{1})\. </td>
<td valign=top class=cnnResults align=left>
<b><a href="http://cnn.com/2006/POLITICS/03/10/sr.fri/index.html">([a-zA-Z0-9\:.-\'\")</a></b>
<span class="resultsDate" style="color:#666666;"> \(([0-9.]*)\)</span>
<br>([a-zA-Z0-9\:-.\s'\"]*)<br><br>
</tr></td>
Then, just use [man]preg_match/man or [man]ereg[/man] and get the results into an array. From that array, you display how you want on your site.