Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send data using HTTP request to a form of a remote server(localhost). Is it possible and how to send data using C# and Receive that data using PHP?.
Please guide me!
Posted

 
Share this answer
 
Comments
Isuru_senanayake 12-Jul-11 4:09am    
thanks frnd!
Prerak Patel 12-Jul-11 4:31am    
You are welcome.
You do not send HTTP request to a form. This is a form on client sends HTTP request to the server. The fact that the form itself was created on server does not matter — you received it in response to your previous request, when you requested for the page.

Now, HTTP request is HTTP request, as well as response — if does not matter what's on the server side: PHP, ASP.NET or anything else. You cannot even determine that from your client side.

To send your data in HTTP request you need from .NET program to use the class System.Net.HttpWebRequest with the Method "POST". You will need to send the same data a form would. To see what data should be sent, look at the HTML code of the form. Compile time type of the request variable will be the class System.Net.WebRequest, as the request's run-time type will be defined based on your URL by its factory method Create.

You will find the code sample here: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].

—SA
 
Share this answer
 
Comments
Isuru_senanayake 12-Jul-11 4:09am    
thanks frnd!
Sergey Alexandrovich Kryukov 12-Jul-11 4:37am    
You're welcome.
Good luck, come back.
--SA
Espen Harlinn 12-Jul-11 9:47am    
Nice answer, my 5
Sergey Alexandrovich Kryukov 12-Jul-11 10:37am    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900