Bonjour,
Je me suis lancé dans un nouveau projet, récupérer certaines informations depuis un site internet en php.
Le but final est de d'afficher ces informations sous la forme d'une page web qui s'affiche sur mon MagicMirror.
Pour ce faire, je suis parti sur PHP Simple Html Dom.
Voici le script à l'état actuel :
L'information à récupérer est le prix dont le libellé est "le dernier cours" (en dessus du graphique OU à droite du graphique"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <?php include_once('simple_html_dom.php');?> <!doctype html> <html> <head> <meta charset="utf8"> <meta http-equiv="X-UA-Compatible" Content="IE=edge"> <title>---</title> <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylsheet"> </head> <body> <?php $html = file_get_html('https://six-group.com/exchanges/funds/security_info_fr.html?id=GREEN'); echo ("Titre : "); foreach($html->find('<h1>') as $numero) { echo $numero->plaintext.' '; } echo ("<br>Dernier cours : "); echo $html->find('SIP_OV_ClosingPrice'); echo ("<br>Variation quotidienne : "); echo $html->find('SIP_OV_ClosingPriceSpecial'); ?> </body> </html>
Vous pouvez voir le site ici : https://six-group.com/exchanges/fund....html?id=GREEN
Dans l'état actuel, j'arrive à récupérer le "titre" mais lorsque j'appelle l'id pour le prix, j’obtiens "Array"...
Pourriez-vous m'indiquer quel est le souci ?
Merci d'avance
Math11
Partager