I'm trying to get the text that contains certain tags within the HTML on a page, I'm using html_simple_dom.php that I thought was good for this. Without more I leave an example of my problem.
This is the function in php
<?php
require ('simple_html_dom.php');
function precioExito($url){
$html = new simple_html_dom();
$html->load_file($url); //Se carga la URL con la libreria
$posts = $html->find('p[class=price offer]'); //Guardamos en Posts el precio que esta en span:price-number
foreach($posts as $post) { //Devuelve un array se recorre con el for para imprimir, como es unico valor, solo imprime 1
$resultado = str_replace ( ".0", '', $post);
break;
}
return $resultado;
}
? >
What I do is that I call this function if I do a echo to that value, which should return to me, show me the value on the screen (see image)
But when that value that returns to me I send it to the BD, this is what keeps me in the BD. (View image)
As you can see, it's bringing me the whole HTML tag and not just the value.
QUESTION
How can I get only the value of this tag to be able to save it?
Thank you very much. I hope I was clear