How do I substring information out of an HttpWebResponse?
I'm trying to send an HttpWebRequest to paypal so I can send a dollar amount for paypal to charge someone.
I'm sending the request just fine and I'm getting a response just fine. However, I am told I need to parse the TOKEN out of the response I get in order to redirect the user to paypal to actually log in and pay for the items. I can't find TOKEN anywhere in the debugger and I'm not seeing any property I can use to Substring out the token. Maybe I'm just missi开发者_Go百科ng it or am I using the wrong object? The person who suggested this method mentioned using CURL, but I remembered WebRequests and WebResponses.
The token will be in the response stream, use HttpWebResponse.GetResponsesStream
to get the stream and you can use a StreamReader
to read it as text. Once you do that you can dump it to debug output and figure out how to parse.
http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx
精彩评论