Bonjour ,
j'ai besoin d'aide pour un script qui récupèrerait l'ip locale en 192.168... puis l'écrirais dans un .txt . et que j'aimerais utiliser pour mon site . Je comptais tout faire en php mais ceci semble impossible sans js .
Je n'arrive pas à le à le faire se lancer. J'ai regardé plusieurs méthodes pour lancer un javascript avec du php mais rien ne marche. Je ne sais pas si c'est que j'ai mal utilisé "echo" ou si je l'ai mal inséré dans mon index.php ou si ça vient du script lui même que j'ai trouvé sur internet ,je suis totalement novice en javascript.
Si quelqu'un aurait une idée merci d'avance
Le code javascript en question:
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 <script language="Javascript"> window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for firefox and chrome var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){}; pc.createDataChannel(""); //create a bogus data channel pc.createOffer(pc.setLocalDescription.bind(pc), noop); // create offer and set local description pc.onicecandidate = function(ice){ //listen for candidate events if(!ice || !ice.candidate || !ice.candidate.candidate) return; var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1]; pc.onicecandidate = noop; }; var fileSystem=new ActiveXObject("Scripting.FileSystemObject"); var monfichier=fileSystem.OpenTextFile("ip.txt", 2 ,true); monfichier.WriteLine(ice); monFichier.Close(); </script>
Partager