mercredi 19 décembre 2018

PHP Curl get information from a Website which loaded with JavaScript

Firstly sorry for my bad English! I have a big problem and I could not find any help in other Forums. So my problem: I make a Android App for a swimming club. One function of the App is to manage the swimmer. So I like to find automatically they best swimming time with only their names. The good thing is there is a website with this function ("http://www.dsv.de/schwimmen/wettkampf-national/schwimmerabfrage/"). There I must insert a first name ("Vorname") and a surname ("Nachname") and confirm this with a button. For example: Paul Biedermann. Then I must click on best times ("Bestzeiten") on the right and then I see a table with all the information. And I like to find the information with PHP and safe it to my Databank. But I do not figure out how I get the table of this site. I hope you can help me. This was my try:

<?php
$url = 'https://dsvdaten.dsv.de/Modules/Results/Individual.aspx?Lang=de-DE';
$data = array('_firstnameTextBox' => 'vorname', '_lastnameTextBox' => 'nachname');

$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }

var_dump($result);
?>




Aucun commentaire:

Enregistrer un commentaire