capture html from an external page take table data and send via Ajax

Asked

Viewed 304 times

0

Next, how can I capture pure html from a page, for example "site.com.br/tabela_precos" this site has a return basically like this:

<html> ....
arquivos e configurações javascript ....
outras tags html ..... 
......

and here a table

<h2 id="tabela_titulo">Título</h2>
    <table id="tabela_info">

<tr>
   <td>Dado da tabela</td>
</tr>

the <tr> e <td> are without id/class, the idea would be to loop them, as they follow a pattern will have no problems...

and after picking up these values, I would like to send them via Ajax to a PHP file

  • Do you have access to this PHP? If so, why not get the table data directly with PHP?

  • I thought it would be faster/easier with javascript since it can access the DOM.

  • 1

    It can easily access your page’s DOM. From an external page, PHP does it in a similar way and you save a request. Just get the HTML code from this page and analyze it with the class DOMDocument.

  • I didn’t know that, thank you very much, I’ll take a look

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.