php - Can I pass multiple links to fopen, fread and feof? -
i have following function :
function doparse($parser_object) { $links=file("./fullsoccer.txt", "r"); $i=0; while(!empty($links[$i])) { set_time_limit(0); if (!($fp = fopen($links[$i], "r"))); { //loop through data while ($data = fread($fp, 4096)) { //parse fragment xml_parse($parser_object, $data, feof($fp)); } } $i++; } }
this code save list of 507 links of xml data fullsocce.txt $links read content of each file (link: online links) using fread , pass $data main function xml_parse parse , save data using sax parser . problem is: last file of array $links passed function , parse data , want know why working 1 file? please emergency case
!($fp = fopen($links[$i], "r")
fopen returns false on error check true @ eof or invild line. maybe changing to
if (($fp = fopen($links[$i], "r") != false)
i noticed ; , ) in if (!($fp = fopen($links[$i], "r"))); maybe i'm not matching properly.
Comments
Post a Comment