Poster un formulaire via winsock

acof Messages postés 2 Date d'inscription dimanche 29 décembre 2002 Statut Membre Dernière intervention 2 janvier 2003 - 2 janv. 2003 à 14:11
la tahzan Messages postés 2 Date d'inscription samedi 18 mars 2006 Statut Membre Dernière intervention 4 avril 2011 - 27 janv. 2011 à 14:21
Bonjour

J'aimerais avoir la syntaxe exacte pour envoyer un formuliare (methode POST) http avec un WINSOC

Merci

4 réponses

Whismerhil Messages postés 8 Date d'inscription mercredi 15 janvier 2003 Statut Membre Dernière intervention 14 mai 2007
26 juin 2003 à 18:00
pareil ...
plus qu'a se prendre la tete sur le protocol http

je m'y recolle je te fais savoir si je trouve :)
0
Whismerhil Messages postés 8 Date d'inscription mercredi 15 janvier 2003 Statut Membre Dernière intervention 14 mai 2007
27 juin 2003 à 10:57
Trouvé !!

Merci a Shivan qui dont la source ( http://www.vbfrance.com/article.aspx?ID=3449 ) m'a permis de trouver la solution.

voila l'entete http a mettre pour reussir la connexion (marche en HTTP/1.0 et HTTP/1.1

avec en variables :
dim url as string
dim host as string

url = "chemin jusqu'a la page"
host = "hote distant"

envoi = "POST /" & url & " HTTP/1.1" & vbCrLf & _
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*" & vbCrLf & _
"Accept -Language: fr" & vbCrLf & _
"Content-Type: application/x-www-form-urlencoded" & vbCrLf & _
"Accept -Encoding: gzip , deflate" & vbCrLf & _
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" & vbCrLf & _
"Host: " & Host.Text & vbCrLf & _
"Content-Length: 28" & vbCrLf & vbCrLf & _ 'la longueur est le nombre de caracteres exacte de la chaine suivante
"login=whismerhil&pass=unpass"

voila
en esperant t'avoir été utile :)
Whis
0
lkm Messages postés 43 Date d'inscription vendredi 28 mai 2004 Statut Membre Dernière intervention 23 novembre 2007
27 juin 2005 à 14:19
Il semblerait qu'il y ai un petit "/" en trop aprés POST et aprés tout fonctionne bien.
Merci tout de même pour cette source qui m'a été vraiment utile.

lkm
0
la tahzan Messages postés 2 Date d'inscription samedi 18 mars 2006 Statut Membre Dernière intervention 4 avril 2011
27 janv. 2011 à 14:21
Bonjour,
s'il vous plait j'ai besoin d'aide ,je voudrai envoyé une variable avec la méthode post pour la récuperer sur une page php.J'utilise VB6.
J'ai essayé d'utiliser le code de whismeril mais j'arrive pas, voici mon code:
Private Sub Command1_Click()
Dim url As String
Dim host As String
Dim Trame As String



serveur.SetFocus
If serveur "" Or port "" Then Exit Sub
ws.Close
ws.RemoteHost = serveur
ws.RemotePort = Val(port)

ws.Protocol = sckTCPProtocol
ws.Connect


url = "http://mondomaine/po.php"
host = "http://mondomaine/"

envoi = "POST " & url & " HTTP/1.0" & vbCrLf & _
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*" & vbCrLf & _
"Accept -Language: fr" & vbCrLf & "Content-Type: application/x-www-form-urlencoded" & vbCrLf & "Accept -Encoding: gzip , deflate" & vbCrLf & _
"User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows vista; DigExt)" & vbCrLf & "Host: " & host & vbCrLf & _
"Content-Length: 28" & vbCrLf & vbCrLf & "login=whismerhil&pass=unpass"


End Sub
Est ce que je doit utiliser un composant winsock.
merci d'avance.
0
Rejoignez-nous