Retrieve data from an external url by source page code

Asked

Viewed 584 times

1

Ola need to get the latitude , and longitude that is in a url

In the source code of the url, there is a table below, what I need is these values -22.96555, -43.17969 that is in (TD 4 of the table) I need it in a variable php someone could help me

<table id="tabela-lista" class="cyber tabela-lista">
	
	<tr id="TStr0" class="">
		<td><a id="nota_0" href="javascript:Abrir('../posicoes/posicoes_nota.php?posicao=1251853304', '_blank', 500, 300);void(0);"><img src="../img/novo.png" height='32px' widht='32px'\></a></td>
		<td>12/04/2017 10:21:57</td>
		<td>12/04/2017 10:22:09</td>
		<td>-22.96555, -43.17969</td>
		<td>0,00</td>
		<td>Temporizado</td>
		<td>Sim</td>
		<td>Ligada</td>
		<td>Satélite</td>
		<td></td>
	</tr>
	
</table>

  • This table is generated dynamically or has how to customize it by placing a class in the td for example?

  • In case I do not have access to the source code in case it is generated Tstr0 ,Tstr1 , Tstr2 more I would like to take only from the last position that is zero

  • What would be this URL you cite? It’s an external page from which you want to extract the information or is a page from your application even?

  • An external page

  • And it requires authentication, right? If yes, I already go ahead to edit your question and put all this information - which are crucial to solving the problem.

  • You will need the functions curl to get the HTML code from the page, performing the proper authentication. Then, with the PHP class DOMDocument you can treat HTML by searching for the row of the desired table through the method getElementById("TStr0") (from PHP, there is no JS here), after searching for the fourth column of this element and extracting its contents.

  • I understood more I don’t know how to do this

  • I know the basics of php

  • 1

    Now you know where to start studying.

  • Kkk because it is necessary to study function cur that first to authenticate the page?

  • I understood, but I confess that the question was very ambiguous, for your case it is normal to use Curl https://imasters.com.br/artigo/4140/php/usando-a-biblioteca-curl-do-php?trace=1519021197&source=single

Show 6 more comments
No answers

Browser other questions tagged

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