loading URL into arrays?
Posted: Tue Nov 12, 2002 12:14 pm
Hi all,
I can get the url no prob, but I'm having trouble extracting what i would like:
this isn't working, but not sure how to accomplish loading the 2 different arrays with the content wanted in $firstArray & $secondArray, (& yes, I need to have some items in those arrays contain a space)?
thanks...
I can get the url no prob, but I'm having trouble extracting what i would like:
Code: Select all
$url = "http://somesite.com";
$firstArray = array ("apple", "banana", "new pears", "spicy something");
$secondArray = array ("blue", "green", "bright yellow", "another color with spaces");
$fp = fopen("$url", "r");
$contents = fread($fp, 100000);
fclose($fp);
$line = explode("\n", $contents );
$linecnt = count($line);
for ($cnt=0; $cnt < $linecnt;$cnt++) {
if (eregi(array($firstArray,$lineї$cnt]))) { //NOT SURE HERE?
$finalArray1ї] = $lineї$cnt];
}
if (eregi(array($secondArray,$lineї$cnt]))) {
$finalArray2ї] = $lineї$cnt];
}
}this isn't working, but not sure how to accomplish loading the 2 different arrays with the content wanted in $firstArray & $secondArray, (& yes, I need to have some items in those arrays contain a space)?
thanks...