[英]Need help understanding this HTTP GET request
I am trying the construct a HTTP GET web request that satisfies the following criteria 我正在尝试构建满足以下条件的HTTP GET Web请求
GET /v1/session
Host: developer.messenger.yahooapis.com
Authorization: < Standard OAuth credentials >
From what I know about get requests is that they are something like this : 据我了解,获取请求是这样的:
https://someaddress.com/¶meterA=valA¶meterB=valB
where parameterA and parameterB are the parameters that are required. 其中parameterA和parameterB是必需的参数。
Now I want to construct a similar address for the above mentioned criteria. 现在,我想为上述标准构建一个类似的地址。 How can I do that.
我怎样才能做到这一点。 I believe the address would be
https://developer.messenger.yahooapis.com
however I am not sure what the other requirements are for such a get request. 我相信地址是
https://developer.messenger.yahooapis.com
但是我不确定这种获取请求的其他要求是什么。 I would appreciate it if someone could disect and specify the requirements of the above(Topmost) Get Request so that I may be able to construct a valid GET request URI. 如果有人可以剖析并指定上面(最上层)Get Request的要求,我将不胜感激,这样我就可以构造一个有效的GET Request URI。
https://developer.messenger.yahooapis.com so your request url should be like https://developer.messenger.yahooapis.com,因此您的请求网址应类似于
https://developer.messenger.yahooapis.com?parameterA=valA¶meterB=valB https://developer.messenger.yahooapis.com?parameterA=valA¶meterB=valB
you get your data in your $_GET array, just add print_r($_GET) 您将数据存储在$ _GET数组中,只需添加print_r($ _ GET)
For a request, you need a URL like 对于请求,您需要一个URL,例如
https://developer.messenger.yahooapis.com
BUT that is only the hostname. 但仅是主机名。 you need to specify a resource that you want to
GET
like /v1/session
, so your URL is 您需要指定要
GET
的资源,例如/v1/session
,因此您的URL为
https://developer.messenger.yahooapis.com/v1/session
If you want to pass some parameters you have to signal that the pointing part of the URL is finished. 如果要传递一些参数,则必须发信号通知URL的指向部分已完成。 You do this with an
?
您使用
?
. 。 Now to add the parameters, you basically add name-value pairs, like
var1=value
. 现在添加参数,您基本上添加了名称-值对,例如
var1=value
。 For multiple params use a &
to seperate them. 对于多个参数,请使用
&
分隔。 Slapping all together you get a 一起拍你会得到一个
https://developer.messenger.yahooapis.com/v1/session?var1=value&var2=value
as URL. 作为网址。 Now hand it to your HttpGet-method.
现在将其交给您的HttpGet方法。
HttpGet will now build a request
and later send it to https://developer.messenger.yahooapis.com
the host/server who will return the resource to your client. HttpGet现在将构建一个
request
,然后将其发送到主机/服务器https://developer.messenger.yahooapis.com
该主机/服务器会将资源返回给您的客户端。 To tell the host that you have the rights to access that resource, the request must contain the neccessary login informations, thats what oAuth
is for. 为了告诉主机您有权访问该资源,请求必须包含必要的登录信息,这就是
oAuth
的用途。 Those credentials have to be added in the request header before executing the get-request. 必须在执行get-request之前将这些凭据添加到请求标头中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.