I have the following problem, in the program below, I get the forms of a website, but I have to specify the exact size of the line that has the form (96), would have the possibility to pick up this number without having to specify manually .
<?php
$url = file_get_contents('site.com');
if(!$url) {
trigger_error('Não foi possível ler a url', E_USER_NOTICE);
}
$var1 = explode("<form", $url);
$string = array();
// Pega o formulário do arquivo HTML.
for($i = 0; $i < 96; $i++) {
$string[0][$i] = $var1[1][$i];
}
?>
I tried to use foreach, but it does not return the right number.
$i = 0;
foreach($var1 as $valor => $detalhes) {
foreach($detalhes as $detalhes => $saida) {
$i++;
}
}
Thank you!