如何使用参数进行HTTP获取请求 [英] How to make an HTTP get request with parameters

查看:177
本文介绍了如何使用参数进行HTTP获取请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 HTTP 获取请求传递参数?如果是这样,那我应该怎么做呢?我找到了 HTTP post requst(链接)。在那个例子中,字符串 postData 被发送到一个web服务器。我想用 get 来代替。 Google在 HTTP 上找到了这个例子,在此处 。但是,没有参数发送到Web服务器。

Is it possible to pass parameters with an HTTP get request? If so, how should I then do it? I have found an HTTP post requst (link). In that example the string postData is sent to a webserver. I would like to do the same using get instead. Google found this example on HTTP get here. However no parameters are sent to the web server.

推荐答案

在GET请求中,您传递参数作为查询字符串的一部分。

In a GET request, you pass parameters as part of the query string.

string url = "http://somesite.com?var=12345";

这篇关于如何使用参数进行HTTP获取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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