I have the following code:
$pollids = "pollids.txt";
$contents = file_get_contents($pollids);
list($pollid) = explode(',', $contents);
echo $pollid;
This opens a text file containing a comma separated list of text: value1,value2,value3 etc…
However it only echo’s the first piece of text in the file. How can I get it to loop/fetch them all?
Secondly, once I have these values, perhaps stored in an array, can i feed them into this piece of script?
$summize = new summize;
$search = $summize->search('searchterm');
$text = $search->results[0]->text;
So that (‘searchterm’) is replaced by each value in the file? Again i suspect some kind of loop within a loop?
Try this:
Or, in a loop:
explodecreates an array of fields separated by,, so$pollfieldsis an array of those fields, and you can feed them to your second snippet like this:Without knowing more of how
summizeworks, that should be what you need.