邮政远程URL,看响应 [英] Post to remote URL, read response

查看:172
本文介绍了邮政远程URL,看响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜查,发现了许多不同的方法来发布表单数据到远程URL(例如<一个href=\"http://stackoverflow.com/questions/6062078/response-redirect-which-posts-data-to-another-url-in-asp-net/6062248#6062248\">here,等等。)。我不能似乎找到一种方法可以做到这一点,解析来自远程服务器的响应,在我的情况基本的HTML解析。只是要清楚我不需要帮助,解析数据,我不知道怎么去的方式,然后我可以使用的响应。这是可能的,使用的htt presponse,或一些其他方法?我似乎记得类似几年前做的,但只是在过去的生活,然后,只在传说。请提前告知和感谢名单。

从服务器样本响应:

 &LT; H1&GT; FormResponse&LT; / H1&GT;&LT; BR&GT;
&LT; CENTER&GT;&LT; B&GT;&LT; I&GT;交易成功&LT;!/ I&GT;&LT; / B&GT;&LT; / CENTER&GT;&LT; BR&GT;
&LT; B&GT;交易编号:LT; / B&GT; TP1H5X06T9RT5T&LT; BR&GT;&LT; B&GT;发布状态:其中; / B&GT;排队&LT; BR&GT;


解决方案

您真正想要做的是使用的WebRequest 的HttpWebRequest

我建议你开始这里

要澄清,你发布的链接是不是你要找的东西。这是当你的code是Web请求,你就写客户端的响应。什么你要找的是要在客户端和发送请求和接收响应。

I have searched and found many different ways to post form data to a remote URL (example here, etc.). What I cant seem to find is a way to do this AND parse the response from the remote server, in my case basic HTML to parse. Just to be clear I dont need help with parsing the data, I dont know how to get the response in a way I can then use. Is this possible, using httpresponse, or some other method? I seem to recall doing similar years ago, but only in a past life, and then, only in legend. Please advise and thanx in advance.

Sample response from server:

<H1>FormResponse</H1><BR>
<CENTER><B><I>Transaction was successful!</I></B></CENTER><BR>
<B>Transaction ID: </B>TP1H5X06T9RT5T<BR><B>Post Status: </B>Queued<BR>

解决方案

What you really want to do is use WebRequest or HttpWebRequest

I suggest you start here

To clarify, the link you posted is not what you're looking for. That's for when your code IS the web request and you're writing a response to the client. What you're looking for is to be the client and to send a request and receive a response.

这篇关于邮政远程URL,看响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆