Here is the html code:
Code: Select all
<div>Your login: admin<br></div>
<div>Your password: gge12jdj<br></div>
Code: Select all
<div>Your login: admin<br></div>
<div>Your password: gge12jdj<br></div>
Code: Select all
// get div inner html by element inner text "Your login"
$login = $div->get_inner_html_by_attribute("innerText", "Your login", false);
// get div inner html by element inner text "Your password"
$password = $div->get_inner_html_by_attribute("innerText", "Your password", false);
// $login contains "Your login: admin<br>";
// $password contains "Your password: gge12jdj<br>";
// get login and password values using function get_string
echo $login=get_string($login,'Your login:','<br>');
echo "<br>";
echo $password=get_string($password,'Your password:','<br>');
// get string by prefix
function get_string($str1, $pr1, $pr2, &$ind_st = 0)
{
// get start index
$ind1 = strpos($str1, $pr1, $ind_st);
if($ind1 === false)
{
return "";
}
$ind1_1 = $ind1 + strlen($pr1);
// get last index
$ind2 = strpos($str1, $pr2, $ind1_1);
if ($ind2 === false)
{
return "";
}
// get substring by prefix
$sres = substr($str1, $ind1 + strlen($pr1), $ind2 - $ind1_1);
return trim($sres);
}
Code: Select all
// get div inner html by element inner text "Your login"
$login = $div->get_inner_html_by_attribute("innerText", "Your login", false,$frame_num);
// get div inner html by element inner text "Your password"
$password = $div->get_inner_html_by_attribute("innerText", "Your password", false,$frame_num);