|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Nov 2000
Messaggi: 279
|
[.NET,C++,Java]POST
Vi ricordate di me?? esatto sono quello della richiesta GET...bene quest'oggi i problemi sono con il POST.
In pratica vorrei inviare una richiesta POST ... con relativi dati... ecco il codice che uso.. penso che sia abbastanza capibile sia per i Javari che per i C++ari.... Codice:
string Post = "POST /test.asp HTTP/1.1\r\nHost: localhost"
+\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 6.0 [en]"
+"\r\nContent-Type: text/xml; charset=utf-8"
+"\r\n\r\nlogin=Alemagno"
+"&password=telemaco"
+"\r\n\r\n";
Byte[] ByteGet = Encoding.UTF8.GetBytes(Post);
String strRetPage = null;
// IPAddress and IPEndPoint represent the endpoint that will
// receive the request.
// Get the first IPAddress in the list using DNS.
IPAddress hostadd = Dns.Resolve(server).AddressList[0];
IPEndPoint EPhost = new IPEndPoint(hostadd, 80);
//Creates the Socket for sending data over TCP.
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
// Connects to the host using IPEndPoint.
s.Connect(EPhost);
// Sends the POST text to the host.
s.Send(ByteGet, ByteGet.Length, SocketFlags.None);
Dove sbaglio?? Nell'encoding, nella formulazione della richiesta o dove?? Ah un'ultima cosa... se dovessi usare nei valori la & o l'= dovrei convertirli in %NUM...vero?? Mi rivolgo ai .NETtiani.. come si chiama questa codifica?? c'è un modo per farla via .NET o la devo fare a mano?? Grazie in anticipo!
__________________
In un arco di tempo abbastanza lungo l'indice di sopravvivenza di ognuno scende a zero |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:28.



















