I am sending POST data to PHP webpage from my windows app using VB.net. The code is as follows:
Dim data As String = "this is a test data push"
Dim wc As New WebClient
wc.Headers(HttpRequestHeader.ContentType) = "application/x-www-form-urlencoded"
wc.UploadStringAsync(uri, data)
The data gets stored. In the PHP page, I am sending an XML response back to the phone
header('Content-type: text/xml');
echo '';
echo '<count>';
echo '<',$i,'>'
echo '</count>';
echo '';
How do I use WebClient to read the RESPONSE back? Any help would be appreciated. Thanks alot.
You need to subscribe to the
UploadStringCompletedevent. See http://msdn.microsoft.com/en-us/library/ms144239.aspx for more details, but here is an excerpt:Drilling farther in, you can see that even returns a
UploadStringCompletedEventArgsobject that includes the results via theResultproperty. See http://msdn.microsoft.com/en-us/library/system.net.uploadstringcompletedeventargs.aspx for more details.