NYCPHP Meetup

NYPHP.org

[nycphp-talk] Searching DMOZ using PHP.

Nasir Zubair lists at ny-tech.net
Thu Dec 4 23:19:36 EST 2003


Hello everyone,

I did a project about a year ago which interfaced with DMOZ for DMOZ
directories and search results. What client wanted was to list results from
his own database on top and then list DMOZ results. I implemented a fairly
straight forward caching system for the categories since they are not
updated as often. But the searching part is directly fetched from DMOZ for
every search.

Here is what I used back then to get search results:

===============================
// prepare search URL for DMOZ.
$searchurl = $searchurl . $searchstring . ($start == "" ? "" : "&start=" .
$start ) . 
($morecat == "" ? "" : "&morecat=" . $morecat);

$fp = fopen( $searchurl, "r" );
$html = join( "", file( $searchurl ) );
fclose ( $fp );
===============================

I have been contacted by the client to revise the code. Along with a few
other things, search results retrieval from DMOZ needs to be looked at again
and optimized. 

I need suggestions as to how I can change the above code to make it better.
Storing RDF dump on the local server is out of the question, as the site is
on a shared server and will not have enough disk space to fit the dump onto
disk/database. 

Thanks,
Nasir




More information about the talk mailing list