简体   繁体   English

在 cURL PHP 中使用 OAuth 1.0 签名中的参数获取请求

[英]GET request with parameters in OAuth 1.0 Signature in cURL PHP

so for some days now i've been struggling with more of a logical issue in performing a GET request.所以几天来,我一直在努力解决执行 GET 请求时更多的逻辑问题。

The problem i am facing is the following:我面临的问题如下:

I want to execute a GET request with cURL in php signed with OAuth 1.0 for a REST Service.我想在使用 OAuth 1.0 签名的 php 中为 REST 服务执行带有 cURL 的 GET 请求。

The problem i am facing is related to signature generation.我面临的问题与签名生成有关。 When i sent the request with base url eg ' https://www.example.com ' everything seems to be fine and i get the 1st page of the result set.当我使用基本 url 发送请求时,例如“ https://www.example.com ”,一切似乎都很好,我得到了结果集的第一页。

When i want to see the 2nd page of the result set i need to sent parameters to the url .eg ' https://www.example.com?limit=100&page=2 ' when i try to pass this url into the signature or as an endpoint for the cURL i get a signature failed error.当我想查看结果集的第 2 页时,我需要将参数发送到 url .eg ' https://www.example.com?limit=100&page=2 ' 当我尝试将此 url 传递到签名中或作为 cURL 的端点,我收到签名失败错误。

I dont understand therefor what am i doing wrong since i am normally trying to encode the whole url to appropriate format required for the OAuth 1.0 signature我不明白我做错了什么,因为我通常试图将整个 url 编码为 OAuth 1.0 签名所需的适当格式

I found the answer.我找到了答案。

I have to encode both url paremeters but also my cURL endpoint had to be the long url (to include the paremeters)我必须对两个 url 参数进行编码,而且我的 cURL 端点必须是长 url(包括参数)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM