NYCPHP Meetup

NYPHP.org

[nycphp-talk] Searching DMOZ using PHP.

Daniel Convissor danielc at analysisandsolutions.com
Thu Dec 4 23:48:43 EST 2003


On Thu, Dec 04, 2003 at 11:19:36PM -0500, Nasir Zubair wrote:

> $searchurl = $searchurl . $searchstring . ($start == "" ? "" : "&start=" .
> $start ) . 
> ($morecat == "" ? "" : "&morecat=" . $morecat);

In that syntax, use ' instead of ".

I'd break that up for clarity.  But, of course, that's a style question...

$searchurl = $searchurl . $searchstring;
if ($start) {
    $searchurl .= "&start=$start";
}
if ($morecat) {
    $searchurl .= "&morecat=$morecat";
}

Some folks might change those if's into one liners, but "that's not my 
style."


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

$html = file_get_contents($searchurl);

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list