如何使用参数发出 HTTP get 请求 [英] How to make an HTTP get request with parameters

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

问题描述

是否可以通过 HTTP get 请求传递参数?如果是这样,我应该怎么做?我发现了一个 HTTP 发布请求(link).在该示例中,字符串 postData 被发送到网络服务器.我想用 get 代替.谷歌在 HTTP 上找到了这个例子,获取这里.但是没有参数被发送到网络服务器.

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 get 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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