I am posting a text area to my php script where I then do a loop for each line of the text area and then using the data from the text area loop another time. I am then trying to set an array for each one and at the end retrieve an array for all of them. However my code is giving me errors:
if (isset($_POST['submit'])) {
$entries = array();
$text = trim($_POST['facebookpage']);
$text = explode("\n", $text);
foreach ($text as $line) {
$data = $html2->find("table.profileInfoTable");
$text2 = trim($data[0]);
$text2 = explode("<tr>", $text2);
foreach ($text2 as $line) {
if (strpos($line, 'Location') !== false) {
$location = $line;
}
}
$data1 = $html2->find("table.profileInfoTable");
$text2 = trim($data1[0]);
$text2 = explode("<tr>", $text2);
foreach ($text2 as $line) {
if (strpos($line, 'Email') !== false) {
$email = $line;
}
}
$mainarray = array("Email" => $email, "Location" => $location);
array_push(($mainarray),$entries);
}
var_dump($entries);
}`
Also the error is:
Fatal error: Only variables can be passed by reference in /home2/statonme/public_html/scraper.php on line 61