PHP / cURL REST 401 /消息失败

时间:2016-05-05 14:51:40

标签: php curl

好的,我收到此错误:

{"Code":401,
"Errors":[{
"Message":"Web request to 'http:\/\/silverstagingapi.ncrsmblab.com\/oauth2authorizationserver\/OAuth2\/Token' failed."}],
"GUID":"00000000-0000-0000-0000-000000000000",
"IsSuccessful":false,
"Message":"Web request to 'http:\/\/silverstagingapi.ncrsmblab.com\/oauth2authorizationserver\/OAuth2\/Token' failed.",
"Result":null}

{"Code":401, "Errors":[{ "Message":"Web request to 'http:\/\/silverstagingapi.ncrsmblab.com\/oauth2authorizationserver\/OAuth2\/Token' failed."}], "GUID":"00000000-0000-0000-0000-000000000000", "IsSuccessful":false, "Message":"Web request to 'http:\/\/silverstagingapi.ncrsmblab.com\/oauth2authorizationserver\/OAuth2\/Token' failed.", "Result":null}

它应该是这样的:

{ "Code": 200, 
"Errors": [], 
"GUID": "00000000-0000-0000-0000-000000000000", 
"IsSuccessful": true, 
"Message": null, 
"Result": { 
"AccessToken": "gAAAACDf3PAniQx1BqJ8qKZVlTQEP7JpvOYglvk8dsBV80mWxtmRCHc1CouejnKbsXEgYbOLXjN7rdZo-Bz535wdulxgkxRTmnEBTSgdZo-DkBHrp-HeiwjlBt_uSIhH7IdIr5dU0w4M_6KgUBI5e1_GWClDHvZY8R5GQahkpy24TGAp9AAAAIAAAAA11W-Eg", 
"AccessTokenExpirationUtc": "/Date(1445616318650)/", 
"AccessTokenIssueDateUtc": "/Date(1445612718666)/", 
"Callback": null, 
"RefreshToken": null, 
"Scope": [ "APIUSER" ] } }
http://pastebin.com/Ryje2B8H

尽管使用了Ctrl + K和代码标签,StackOverflow仍然说代码是未格式化的,所以我链接到语法高亮的pastebin。我得到JSON响应的事实意味着API正在运行/响应。但它并没有给我任何东西,只有401离开。在尝试curl之前我尝试了fsockopen()并且它完全拒绝了连接。使用cURL我得到了一个响应但无论如何都失败了。

1 个答案:

答案 0 :(得分:0)

想出来。 API仅限于3个特定的软件合作伙伴,因此我所拥有的密钥/机密/数据并不重要。 API仅接受来自特定域或供应商的请求。