I have written Windows/PocketPC based applications to communicate with various payment gateways. And am now looking to provide same for the iPhone.
The only trouble I am having is with the POST to the gateway. In .Net we use something like this:
HttpWebRequest objRequest = (HttpWebRequest)WebRequest
.Create(po
st_url);
objRequest.Method = "POST";
objRequest.ContentLength = post_string.Length;
objRequest.ContentType = "application/x-www-form-ur
lencoded";
// post data is sent as a stream
StreamWriter myWriter = null;
myWriter = new StreamWriter(objRequest.Ge
tRequestSt
ream());
myWriter.Write(post_string
);
myWriter.Close();
// returned values are returned as a stream, then read into a string
String post_response;
HttpWebResponse objResponse = (HttpWebResponse)objReques
t.GetRespo
nse();
using (StreamReader responseStream = new StreamReader(objResponse.G
etResponse
Stream()) )
{
post_response = responseStream.ReadToEnd()
;
responseStream.Close();
}
I am using the code below and the returned data is HTML not the data expected. In .Net you form the request and then create a StreamReader to grab the data. Am I missing a property from the NSHTTPURLResponse?? Or am I going about the wrong way??