OVH Cloud OVH Cloud

Wan

21 réponses
Avatar
Pierre
Bonjour,

Je cherche à connaîter l'adresse IPWan d'un poste. Manuellement, j'irai par
exemple sur www.ipeee.com
mais je voudrai le faire par une API.

Je ne désire pas utiliser l'OCX msinet.ocx car il ne focntionne pas sur tous
les postes ni l'API URLDownloadToFile qui me génère un fichier mais une
commande comme
IP = principale.Inet1.OpenURL("http://testip.free.fr/ip.php")

mais sans utiliser msinet.ocx. Quelqu'un a t'il une solution?


--
D'avance merci
Meilleures salutations
Pierre

1 réponse

1 2 3
Avatar
Pierre
merci encore

--
D'avance merci
Meilleures salutations
Pierre
"tking" a écrit dans le message de news:

Pierre a émis l'idée suivante :
Et ben, j'en ai appris des choses. Encore merci.

J'ai encore une question, étant un nul en HTML, comment puis-je connaitre
la commande GET de l'entête qu'un site veut recevoir.

Par exemple, j'ai du mettre
"GET " & URLPageWeb & " HTTP/1.0" & vbCrLf & "Accept: */*" & vbCrLf &
"Accept: text/html" & vbCrLf & vbCrLf
pour que ca fonctionne (j'ai trouvé ca sur internet) mais ca ne marche
pas partout.


Dim CommandeHTTP As String
Dim URLPageWeb As String
URLPageWeb = "http://www.ipeee.com"
'URLPageWeb =
"http://www.the-eggman.com:80/seminars/server_vars.shtml"
'URLPageWeb = "/"
CommandeHTTP = "GET " & URLPageWeb & " HTTP/1.0" & vbCrLf & "Accept:
*/*" & vbCrLf & "Accept: text/html" & vbCrLf & vbCrLf
winsock1.SendData CommandeHTTP

PS : pour l'instant j'ai testé avec l'OCX mais bon, l'API ne doit pas
être bien différente.







' marche avec
' http://www.bliao.com:2000/ip.phtml
'
'
' mettre un bouton command1 et un text1.text sur la feuille
' ajoutez winsock


Private Sub Command1_Click()

Winsock1.Close
Winsock1.Connect "www.bliao.com", 2000

End Sub



Private Sub winsock1_connect()

Winsock1.SendData "GET http://" & Winsock1.RemoteHost & "/ip.phtml" & "
HTTP/1.0" & vbCrLf
Winsock1.SendData "Accept: */*" & vbCrLf
Winsock1.SendData "Accept-Language: en-us" & vbCrLf
Winsock1.SendData "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5;
Windows 95)" & vbCrLf

Winsock1.SendData vbCrLf


End Sub



Private Sub winsock1_DataArrival(ByVal bytesTotal As Long)

Dim webData As String
Winsock1.GetData webData, vbString

Text1.Text = webData

End Sub


' gere la fin de connexion
'
Private Sub winsock1_close()

'
'
'

end sub



au final tu reçois ça, sans les "===="

============================== >
HTTP/1.1 200 OK
Date: Fri, 22 Jun 2007 11:06:44 GMT
Server: Apache/1.3.32 (Unix) PHP/4.3.11
X-Powered-By: PHP/4.3.11
Connection: close
Content-Type: text/html

90.32.167.63

=============================== >



1 2 3