Votre question

Aide pour script PHP

Tags :
  • Script
  • Programmation
Dernière réponse : dans Programmation
12 Mai 2008 12:53:15

Bonjour

voila j'ai une page qui me permet de déconnecter et reconnecter mon modem automatiquement. Ce qui m'évite en cas de problème d'aller sur la page du modem, et d'aller faire ca manuellement.

Cependant ma page fonctionnait bien avec mon modem mais j'ai du changer de modem car le précédent ne s'allumait plus.

Le nouveau est un modem belkin comme le précédent mais ma page ne marche pas avec ce nouveau model.

Est ce qu'il serait possible de m'aider a modifier mon script afin qu'il fonctionne avec ce nouveau model? Pour se faire, je vais donc afficher le script que j'avais fait avant et également la page source du modem.

J'ai deja essayer moi meme de la faire, il redémarre bien le modem mais apres il tente de charger la page "action" et dit qu'elle n'existe pas. Moi je veux juste qu'il redemarre le modem et ne tente pas de charger une page.

Script php:
  1. <?php
  2.  
  3. $ch = curl_init();
  4.  
  5. curl_setopt($ch, CURLOPT_URL,"http://192.168.2.1/home.htm");
  6. curl_setopt($ch, CURLOPT_POST, 1);
  7. curl_setopt($ch, CURLOPT_POSTFIELDS,
  8. "PPP_Connect=0&PPP_Disconnect=0&disconnect=Disconnect");
  9.  
  10. curl_exec ($ch);
  11. curl_close ($ch);
  12.  
  13.  
  14. sleep(3);
  15.  
  16. $ch = curl_init();
  17.  
  18. curl_setopt($ch, CURLOPT_URL,"http://192.168.2.1/home.htm");
  19. curl_setopt($ch, CURLOPT_POST, 1);
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, "PPP_Connect=0&PPP_Disconnect=0&connect=Connect");
  21. curl_exec ($ch);
  22. curl_close ($ch);
  23.  
  24. ?>


Et voici la page source du nouveau modem:
  1. <html>
  2.  
  3. <head>
  4.  
  5. <link rel="stylesheet" href="/webconfig/styles/main_router.css" tppabs="/styles/main_router.css" type="text/css">
  6.  
  7. <SCRIPT language="JavaScript" src="/webconfig/styles/function.js"></SCRIPT>
  8.  
  9. <script language="JavaScript">
  10.  
  11. setTimeout('document.location.href="/logout.htm";', 600000);
  12.  
  13. function ppp_connect()
  14.  
  15. {
  16.  
  17. document.tF.action.value = "connect";
  18.  
  19. return true;
  20.  
  21. }
  22.  
  23.  
  24.  
  25. function ppp_disconnect()
  26.  
  27. {
  28.  
  29. document.tF.action.value = "disconnect";
  30.  
  31. return true;
  32.  
  33. }
  34.  
  35. //show clock
  36. var beInitialized = 0;
  37. var timeString = '10.05.2008 20:18:48 ';
  38.  
  39. function funClock() {
  40. var runTime = new Date();
  41. var hours = document.tF.hour.value;
  42. var minutes = document.tF.min.value;
  43. var seconds = document.tF.sec.value;
  44. var dn = "AM";
  45. var isFirefox = false;
  46.  
  47. if (!document.layers && !document.all) {
  48. isFirefox = true;
  49. //return;
  50. }
  51.  
  52. if (hours >= 12) {
  53. dn = "PM";
  54. hours = hours - 12;
  55. }
  56. if (beInitialized != 0)
  57. {
  58. if (seconds == 0)
  59. {
  60. minutes++;
  61. document.tF.min.value++;
  62. if(minutes ==60)
  63. {
  64. hours++;
  65. document.tF.hour.value++;
  66. minutes = 0;
  67. document.tF.min.value = 0;
  68. }
  69. }
  70. }else beInitialized++;
  71.  
  72. if (hours == 12 && minutes == 0 && seconds == 0)
  73. {
  74. document.location.href="util_system.html";
  75. return;
  76. }
  77.  
  78. if (minutes <= 9) {
  79. minutes = "0" + minutes;
  80. }
  81.  
  82. if (seconds <= 9) {
  83. seconds = "0" + seconds;
  84. }
  85.  
  86. movingtime = "<b>"+ hours + ":" + minutes + ":" + seconds + " " + dn + "</b>";
  87. if (document.layers) {
  88. document.layers.clock.document.write(movingtime);
  89. document.layers.clock.document.close();
  90. }
  91. else if (document.all) {
  92. clock.innerHTML = movingtime;
  93. }
  94. else if (isFirefox) {
  95. document.getElementById("clock").innerHTML = movingtime;
  96. }
  97.  
  98. document.tF.sec.value++;
  99. if(document.tF.sec.value>59)
  100. {
  101. document.tF.sec.value = 0;
  102. }
  103. setTimeout("funClock()", 1000)
  104. }
  105.  
  106. function initVariables() {
  107.  
  108. //timeString is like '15.07.2003 13:12:25'
  109. document.tF.day.value = parseInt(timeString.substring(0,2));
  110. if(timeString.substring(3,4) != '0')
  111. document.tF.mon.value = parseInt(timeString.substring(3,5));
  112. else
  113. document.tF.mon.value = parseInt(timeString.substring(4,5));
  114. document.tF.year.value = parseInt(timeString.substring(6,10));
  115. document.tF.hour.value = parseInt(timeString.substring(11,13));
  116. document.tF.min.value = parseInt(timeString.substring(14,16));
  117. document.tF.sec.value = parseInt(timeString.substring(17,19));
  118. }
  119.  
  120. window.onload = funClock;
  121. //end of 'show clock'
  122. </script>
  123.  
  124. <title>Status</title>
  125.  
  126. </head>
  127.  
  128. <body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. <script language="javascript">
  137.  
  138. show_title_menu();
  139.  
  140. </script>
  141.  
  142. <font face="verdana,arial" size="2" color="#33FF33">Connected</font>
  143.  
  144. <script language="javascript">
  145.  
  146. show_panel_menu('NULL', 'Home', '');
  147.  
  148. </script>
  149.  
  150. <FORM name="tF" method="post" ACTION="/home.htm">
  151.  
  152. <INPUT name="action" type="hidden" VALUE="">
  153.  
  154. <INPUT type="hidden" name="year" VALUE="">
  155. <INPUT type="hidden" name="mon" VALUE="">
  156. <INPUT type="hidden" name="day" VALUE="">
  157. <INPUT type="hidden" name="hour" VALUE="">
  158. <INPUT type="hidden" name="min" VALUE="">
  159. <INPUT type="hidden" name="sec" VALUE="">
  160.  
  161. <table width="720" border="0" cellspacing="0" cellpadding="0" class="copy_1">
  162. <tr><td>
  163. <table width="370" border="0" cellspacing="0" cellpadding="2" class="copy_1">
  164. <tr>
  165. <td width="180" class="copy_1" colspan="2"><INPUT type="button" value="Setup Wizard " style="{width:120px;}" class="submitBtn" onMouseOver="window.status='Wizard'; return true;" onMouseOut="window.status=''; return true;" onClick="document.location.href='/wizard.htm';"></td>
  166. <td width="180"> </td>
  167. </tr><tr>
  168. <td width="180"> </td>
  169. <td width="180"> </td>
  170. </tr>
  171.  
  172. </table></td><td>
  173. <table width="370" border="0" cellspacing="0" cellpadding="2" class="copy_1">
  174. <tr>
  175.  
  176.  
  177. <td width="180" class="copy_1"><INPUT type=submit name=disconnect style="font-size: 10px;font-family:Arial;" onClick="return ppp_disconnect();" VALUE="Disconnect"></td>
  178.  
  179. <td width="180" class="copy_1"><INPUT type=submit name=connect style="font-size: 10px;font-family:Arial;" onClick="return ppp_connect();" VALUE=" Connect "></td>
  180.  
  181.  
  182. </tr><tr>
  183. <td width="180"> </td>
  184. <td width="180"> </td>
  185. </tr>
  186. </table></td></tr>
  187.  
  188. </table>
  189. <table width="720" border="0" cellspacing="0" cellpadding="0" class="copy_1">
  190.  
  191. <tr>
  192.  
  193. <td width=370 valign=top class="section">
  194.  
  195. <table width="370" border="0" cellspacing="0" cellpadding="2" class="copy_1">
  196.  
  197. <tr>
  198. <td bgcolor="#006699" class="section" colspan=2>System Date and  Time</td>
  199. </tr>
  200.  
  201. <tr>
  202. <td width="180" bgcolor="#94CAE4" class="copy_1">   Current
  203. Time</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  204. <script type="text/javascript">
  205. var d=new Date();
  206. var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  207. initVariables();
  208. document.write(monthname[document.tF.mon.value-1] + " ")
  209. document.write(document.tF.day.value + ", ")
  210. document.write(document.tF.year.value)
  211. </script>
  212. <span id="clock" style="position:relative;"></span>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td width="180" class="copy_1"> </td><td width="190" class="copy_1"> </td>
  217.  
  218. </tr>
  219.  
  220. <tr><td bgcolor="#006699" class="section" colspan=2>Version Info</td></tr>
  221.  
  222. <tr><td width="180" bgcolor="#94CAE4" class="copy_1">   Firmware Version</td><td width="190" bgcolor="#94CAE4" class="copy_1">F5D7632v1.UK.1.00.09 (Oct 18 2005 14:12:32)</td></tr>
  223.  
  224. <tr><td width="180" bgcolor="#E8F8FF" class="copy_1">   Boot Code Version</td><td width="190" bgcolor="#E8F8FF" class="copy_1">V1.0A</td></tr>
  225.  
  226. <tr><td width="180" bgcolor="#94CAE4" class="copy_1">   Hardware Version</td><td width="190" bgcolor="#94CAE4" class="copy_1">R01</td></tr>
  227.  
  228. <tr><td width="180" bgcolor="#E8F8FF" class="copy_1">   Serial Number</td><td width="190" bgcolor="#E8F8FF" class="copy_1">S516025887</td></tr>
  229.  
  230. <tr>
  231.  
  232. <td width="180" class="copy_1"> </td><td width="190" class="copy_1"> </td>
  233. </tr>
  234. <tr>
  235. <td bgcolor="#006699" class="section" colspan=2>Internet Settings</td>
  236. </tr>
  237. <tr>
  238. <td width="180" bgcolor="#94CAE4" class="copy_1">  
  239. ADSL Status</td>
  240. <td width="190" bgcolor="#94CAE4" class="copy_1">
  241.  
  242. CONNECTED
  243.  
  244. </td>
  245. </tr>
  246. <tr>
  247. <td width="180" bgcolor="#E8F8FF" class="copy_1">  
  248. Data Rate<br>   Downstream/Upstream</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  249.  
  250. 3360Kb/512Kb
  251.  
  252. </td>
  253. </tr>
  254.  
  255. <tr>
  256. <td width="180" bgcolor="#94CAE4" class="copy_1">   Connection Type</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  257.  
  258. PPPoA
  259.  
  260. </td>
  261. </tr>
  262. <tr>
  263. <td width="180" bgcolor="#E8F8FF" class="copy_1">   WAN MAC Address</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  264.  
  265.  
  266. 00:11:50:48:C4:F0
  267.  
  268.  
  269. </td>
  270. </tr>
  271. <tr>
  272. <td>
  273.  
  274.  
  275.  
  276.  
  277.  
  278. </tr>
  279. <tr>
  280. <td width="180" bgcolor="#94CAE4" class="copy_1">   WAN IP</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  281.  
  282.  
  283. 212.87.122.26
  284.  
  285. </td>
  286. </tr>
  287. <tr>
  288. <td width="180" bgcolor="#E8F8FF" class="copy_1">   Subnet Mask</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  289.  
  290. 255.255.255.0
  291.  
  292. </td>
  293. </tr>
  294. <tr>
  295. <td width="180" bgcolor="#94CAE4" class="copy_1">   Default Gateway</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  296.  
  297.  
  298. 212.87.120.1
  299.  
  300. </td>
  301. </tr>
  302. <tr>
  303. <td width="180" bgcolor="#E8F8FF" class="copy_1">   Primary DNS Address</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  304.  
  305. ripley.euphonynet.be
  306.  
  307. </td>
  308. </tr>
  309. <tr>
  310. <td width="180" bgcolor="#94CAE4" class="copy_1">  
  311. Secondary DNS Address</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  312.  
  313.  
  314. howie.besite.be
  315.  
  316. </td>
  317. </tr>
  318. </table>
  319.  
  320. </td>
  321.  
  322. <td width=20> </td>
  323.  
  324. <td width=330 valign=top class="section">
  325.  
  326. <table width="370" border="0" cellspacing="0" cellpadding="2" class="copy_1">
  327.  
  328. <tr><td bgcolor="#006699" class="section" colspan=2>LAN Settings</td></tr>
  329.  
  330. <tr>
  331. <td width="150" bgcolor="#94CAE4" class="copy_1">   Interface Status</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  332.  
  333. Connected
  334.  
  335. </td>
  336. </tr>
  337. <tr>
  338. <td width="150" bgcolor="#E8F8FF" class="copy_1">   Link Status</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  339.  
  340.  
  341. 100Mbps Full Duplex
  342.  
  343. </td>
  344. </tr>
  345.  
  346. <tr><td width="150" bgcolor="#94CAE4" class="copy_1">   LAN MAC Address</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  347.  
  348.  
  349.  
  350. 00:11:50:48:C4:F0
  351.  
  352. </td></tr>
  353.  
  354.  
  355.  
  356. <tr><td width="150" bgcolor="#E8F8FF" class="copy_1">   Router IP Address</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363. 192.168.2.1
  364.  
  365.  
  366.  
  367. </td></tr>
  368.  
  369. <tr><td width="150" bgcolor="#94CAE4" class="copy_1">   Subnet Mask</td><td width="190" bgcolor="#94CAE4" class="copy_1">
  370.  
  371.  
  372.  
  373. 255.255.255.0
  374.  
  375. </td></tr>
  376.  
  377. <tr><td width="150" bgcolor="#E8F8FF" class="copy_1">   DHCP Server</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387. Enabled
  388.  
  389.  
  390.  
  391. </td></tr>
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398. <tr>
  399. <td width="150" bgcolor="#94CAE4" class="copy_1">   Number of DHCP Clients</td><td width="190" bgcolor="#94CAE4" class="copy_1">5</td>
  400. </tr>
  401. <tr>
  402. <td width="180" class="copy_1" bordercolor="#E8F8FF"> </td><td width="190" class="copy_1" bordercolor="#E8F8FF"> </td>
  403. </tr>
  404. <tr>
  405.  
  406. <td width="180" class="copy_1"> </td><td width="190" class="copy_1"> </td>
  407. </tr>
  408. <tr>
  409. <td bgcolor="#006699" class="section" colspan=2>WLAN Settings</td>
  410. </tr>
  411. <tr>
  412. <td width="150" bgcolor="#94CAE4" class="copy_1">   Wireless Function</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  413.  
  414.  
  415.  
  416.  
  417.  
  418. Enabled
  419.  
  420.  
  421.  
  422. </td>
  423. </tr>
  424. <tr>
  425.  
  426. <td width="150" bgcolor="#E8F8FF" class="copy_1">   WLAN MAC Address</td><td width="190" bgcolor="#E8F8FF" class="copy_1">
  427.  
  428. 00:12:bf:09:69:0e
  429.  
  430. </td>
  431. </tr>
  432. <tr>
  433. <td width="150" bgcolor="#94CAE4" class="copy_1">   Mode</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  434.  
  435. Mixed (11b+11g)
  436.  
  437. </td>
  438. </tr>
  439. <tr>
  440. <td width="150" bgcolor="#E8F8FF" class="copy_1">   SSID</td><td width="180" bgcolor="#E8F8FF" class="copy_1">
  441.  
  442.  
  443.  
  444.  
  445. belkin54g
  446.  
  447. </td>
  448. </tr>
  449. <tr>
  450. <td width="150" bgcolor="#94CAE4" class="copy_1">   ESSID Broadcast</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  451.  
  452. Enabled
  453.  
  454. </td>
  455. </tr>
  456. <tr>
  457. <td width="150" bgcolor="#E8F8FF" class="copy_1">   Channel</td><td width="180" bgcolor="#E8F8FF" class="copy_1">
  458.  
  459. 11
  460.  
  461.  
  462. </td>
  463. </tr>
  464. <tr>
  465. <td width="150" bgcolor="#94CAE4" class="copy_1">   Security</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  466.  
  467. WEP
  468.  
  469. </td>
  470. </tr>
  471. <tr>
  472. <td width="180" class="copy_1"> </td><td width="190" class="copy_1"> </td>
  473. </tr>
  474. <tr>
  475. <td bgcolor="#006699" class="section" colspan=2>Advanced Features</td>
  476.  
  477. </tr>
  478. <tr>
  479. <td width="150" bgcolor="#94CAE4" class="copy_1">   UPnP</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  480.  
  481. Disabled
  482.  
  483. </td>
  484. </tr>
  485. <tr>
  486. <td width="150" bgcolor="#E8F8FF" class="copy_1">   NAT</td><td width="180" bgcolor="#E8F8FF" class="copy_1">
  487.  
  488. Enabled
  489.  
  490. </td>
  491. </tr>
  492.  
  493. <tr>
  494. <td width="150" bgcolor="#94CAE4" class="copy_1">   Firewall</td><td width="180" bgcolor="#94CAE4" class="copy_1">
  495.  
  496. Disabled
  497.  
  498. </td>
  499. </tr>
  500.  
  501. </table>
  502.  
  503. </td>
  504.  
  505. </tr>
  506.  
  507. </table>
  508.  
  509. <br> <br>
  510.  
  511. <script language="javascript">
  512.  
  513. show_menu_table_end();
  514.  
  515. </script>
  516.  
  517. </FORM>
  518.  
  519. </body>
  520.  
  521. </html>

Autres pages sur : aide script php

13 Mai 2008 00:14:02

personne?
Tom's guide dans le monde
  • Allemagne
  • Italie
  • Irlande
  • Royaume Uni
  • Etats Unis
Suivre Tom's Guide
Inscrivez-vous à la Newsletter
  • ajouter à twitter
  • ajouter à facebook
  • ajouter un flux RSS