J'ai regard� les extensions chrome. Je ne connaissais pas. Je pense avoir compris le syst�me sauf s'il est possible d'utiliser une extension dans une autre page html et comment les debugger. Ca sera mon d�fi des prochaines semaines... si j'ai assez de courage.
N�anmoins j'ai essay� � partir d'Ajax et de php en utilisant CURL et ma fois �a fonctionne pas trop mal.
Pi�ce jointe 257145
__________________________________________________________________
Pi�ce jointe 257152
__________________________________________________________________
Code:
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 <!DOCTYPE html> <html> <head> <title>Untitled</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script language="JavaScript" type="text/javascript"> <!-- function titi() { var res = Math.random(); var lon = document.getElementById('lon').value; var lat = document.getElementById('lat').value; var userid = document.getElementById('userid').value; var param = '&lon='+lon+'&lat='+lat+'&userid='+userid+'&r='+res; $.ajax({ url : 'test9187b.php', type : 'GET', data : param, dataType : 'html' }).done(function(html) {$('#resultat').html(html)}) ; } //--> </script> <meta http-equiv="pragma" content="no-cache" /> </head> <body> <table summary=""> <tr> <td>Lon : </td><td><input type="text" id="lon" /></td> </tr> <tr> <td>Lat : </td><td><input type="text" id="lat" /></td> </tr> <tr> <td>User: </td><td><input type="text" id="userid" /></td> </tr> </table> <input type="button" value="Clique" onclick="titi();"/> <div id="resultat"> </div> </body> </html>
test9187b.php
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <?php // éventuellement mettre la course en paramètre <= clipperton-noumea $lat = $_GET['lat']; $lon = $_GET['lon']; $userid = $_GET['userid']; $ch = curl_init("<a href="http://sail.zezo.org/clipperton-noumea/chart.pl?lat=$lat&lon=$lon&userid=$userid" target="_blank">http://sail.zezo.org/clipperton-noum...userid=$userid</a>"); $fp = fopen("resultat_course.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $string = file_get_contents("resultat_course.txt"); unlink("resultat_course.txt"); include("test9187c.php");
test9187c.php
Code:
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 <?php //$string = file_get_contents('test9104b.html'); $pattrn = "/updi\(event\,\'(.*)'\)/m"; preg_match_all($pattrn,$string,$array); $arrResultat = array(); foreach($array[1] as $value) { $str2 = str_replace("<br>Distances: " ,"|",$value); $str2 = str_replace("<br><b>Wind:</b>" ,"|",$str2); $str2 = str_replace("(<b>TWA" ,"|",$str2); $str2 = str_replace("</b>)<br><b>Heading:</b>" ,"|",$str2); $str2 = str_replace("<b>Sail:</b>" ,"|",$str2); $str2 = str_replace("<br><b>Boat Speed:</b>" ,"|",$str2); $str2 = str_replace("','" ,"|",$str2); $arrResultat[] = $str2; } ob_start();?> <table border="1"> <tr> <td>Date et heure</td><td>Distances</td><td>Wind</td><td>TWA</td><td>Heading</td><td>Sail</td><td>Boat Speed</td> </tr><?php foreach($arrResultat as $value) { $arrInfo = explode('|',$value); $TWA = (int) $arrInfo[3]; $color = $TWA >= 0 ? 'green' : 'red';?> <tr> <td><?php print $arrInfo[0];?></td> <td><?php print $arrInfo[1];?></td> <td><?php print $arrInfo[2];?></td> <td style="color:<?php print $color;?>"><?php print abs($TWA);?></td> <td><?php print $arrInfo[4];?></td> <td><?php print $arrInfo[5];?></td> <td><?php print $arrInfo[6];?></td> </tr><?php }?> </table><?php $tableau = ob_get_contents(); ob_end_clean(); print $tableau; ?>