Hello,
I'm using QHttp objects to fll a form, submit it and download the server response.
So I made 2 QHttp objects : the first fill the form with a POST header, and the second download the response with a GET header.
Working under Windows 2000 / XP, I've added the host value in the HOST file of the system :
# Copyright (c) 1993-1999 Microsoft Corp.
#
# Ceci est un exemple de fichier HOSTS utilisé par Microsoft TCP/IP
# pour Windows.
#
# Ce fichier contient les correspondances des adresses IP aux noms d'hôtes.
# Chaque entrée doit être sur une ligne propre. L'adresse IP doit être placée
# dans la première colonne, suivie par le nom d'hôte correspondant. L'adresse
# IP et le nom d'hôte doivent être séparés par au moins un espace.
#
# De plus, des commentaires (tels que celui-ci) peuvent être insérés sur des
# lignes propres ou après le nom d'ordinateur. Ils sont indiqué par le
# symbole '#'.
#
# Par exemple :
#
# 102.54.94.97 rhino.acme.com # serveur source
# 38.25.63.10 x.acme.com # hôte client x
127.0.0.1 localhost
192.168.1.12 courriel
# Copyright (c) 1993-1999 Microsoft Corp.
#
# Ceci est un exemple de fichier HOSTS utilisé par Microsoft TCP/IP
# pour Windows.
#
# Ce fichier contient les correspondances des adresses IP aux noms d'hôtes.
# Chaque entrée doit être sur une ligne propre. L'adresse IP doit être placée
# dans la première colonne, suivie par le nom d'hôte correspondant. L'adresse
# IP et le nom d'hôte doivent être séparés par au moins un espace.
#
# De plus, des commentaires (tels que celui-ci) peuvent être insérés sur des
# lignes propres ou après le nom d'ordinateur. Ils sont indiqué par le
# symbole '#'.
#
# Par exemple :
#
# 102.54.94.97 rhino.acme.com # serveur source
# 38.25.63.10 x.acme.com # hôte client x
127.0.0.1 localhost
192.168.1.12 courriel
To copy to clipboard, switch view to plain text mode
So my host is "courriel", with the IP adress 192.168.1.12
Everything forks fine... On my computer .
When I want to use my application on other computer, I get an error cause the QHttp objects can't find the host value for "courriel". Of course, the HOST file hasn't been edited !
So, I used directly the IP adress in my application, but then I get a 404 error : host not found .
IL_http
= new QHttp("192.168.1.12",
80);
header.setValue("Host", "192.168.1.12");
header.setContentType("application/x-www-form-urlencoded");
header.setContentLength(content.length());
IL_httpId = IL_http->request(header, content);
IL_http = new QHttp("192.168.1.12", 80);
QHttpRequestHeader header("POST", "/index.php?tg=login&cmd=signon");
header.setValue("Host", "192.168.1.12");
header.setContentType("application/x-www-form-urlencoded");
header.setContentLength(content.length());
IL_httpId = IL_http->request(header, content);
To copy to clipboard, switch view to plain text mode
The QHttp constructeur needs a "hostname" and not a "host adress", but is it possible to work directly with an IP adresse ?
Else, is it possible to set a host reference oly for this application ? like an intrnal host file ?
Bookmarks