Searching WordPress.com with PHP

One of my students wants to search WordPress.com entries in her project.  Here’s how!


	
	

title; ?>

by author; ?> on epoch_time); ?>

content; ?>

PS: If your server complains about ‘file_get_contents’, paste in this function and replace ‘file_get_contents’ with ‘curl_get_contents’

function curl_get_contents($url) {
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)');
	curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
	curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
	curl_setopt($ch, CURLOPT_AUTOREFERER, true);
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}
 
People: Jeff Crouse
Tags: Howtus