2009-06-03 8 views

risposta

70

Aggiungere ?var1=data1&var2=data2 alla fine dell'URL di presentare i valori alla pagina tramite GET:

using System.Net; 
using System.IO; 

string url = "https://www.example.com/scriptname.php?var1=hello"; 

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); 
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
Stream resStream = response.GetResponseStream(); 
+0

Questo codice è stato testato con successo da chiunque? –

+0

Funziona bene per me. –

+3

Nota: questo funziona per HTTP, ho testato questo codice con l'URL HTTPS e non ha funzionato. Andando a provare WebClient e vedere se funziona con SSL – Pavdro