1、企鹅号的第三方平台应用接口HTTP请求,视频文件分片上传失败,状态码:302。打印响应对象。时间:2021/10/12
yii/httpclient/Response Object ( [client] => yii/httpclient/Client Object ( [baseUrl] => http://api.om.qq.com [formatters] => Array ( ) [parsers] => Array ( ) [requestConfig] => Array ( ) [responseConfig] => Array ( ) [contentLoggingMaxSize] => 2000 [_transport:yii/httpclient/Client:private] => yii/httpclient/CurlTransport Object ( [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => ) [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => Array ( ) ) [_headers:yii/httpclient/Message:private] => Array ( [0] => HTTP/1.1 302 Moved Temporarily [1] => Server: stgw/1.3.12.4_1.13.5 [2] => Date: Tue, 12 Oct 2021 03:01:13 GMT [3] => Content-Type: text/html [4] => Content-Length: 169 [5] => Connection: keep-alive [6] => Location: https://api.om.qq.com/video/authuploadtrunk?access_token=L3JWJY62NKATAKX4YHE7DA&openid=4a4e3035a68accadc82b91156a9a0821&transaction_id=781312031335346181&start_offset=0 ) [_cookies:yii/httpclient/Message:private] => [_content:yii/httpclient/Message:private] => <html> <head><title>302 Found</title></head> <body bgcolor="white"> <center><h1>302 Found</h1></center> <hr><center>stgw/1.3.12.4_1.13.5</center> </body> </html> [_data:yii/httpclient/Message:private] => [_format:yii/httpclient/Message:private] => [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => )
2、分析结论,查看响应头中的信息,HTTP/1.1 302 Moved Temporarily。从 http://api.om.qq.com 302 跳转至 https://api.om.qq.com 。HTTP 302 Found 重定向状态码表明请求的资源被暂时的移动到了由该HTTP响应的响应头Location 指定的 URL 上。如图1
3、查看企鹅号的官方接口文档。网址:https://open.om.qq.com/resources/resourcesCenter 。确定仍然是 http 协议。如图2
4、http://api.om.qq.com 。决定设置其值:https://api.om.qq.com 。调整为 https 协议。
5、企鹅号的第三方平台应用接口HTTP请求,视频文件分片上传成功,状态码:200。打印响应对象。说明官方接口调整为 https 协议后,文档未及时更新。如图3
yii/httpclient/Response Object ( [client] => yii/httpclient/Client Object ( [baseUrl] => https://api.om.qq.com [formatters] => Array ( ) [parsers] => Array ( ) [requestConfig] => Array ( ) [responseConfig] => Array ( ) [contentLoggingMaxSize] => 2000 [_transport:yii/httpclient/Client:private] => yii/httpclient/CurlTransport Object ( [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => ) [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => Array ( ) ) [_headers:yii/httpclient/Message:private] => Array ( [0] => HTTP/1.1 100 Continue [1] => HTTP/1.1 200 OK [2] => Date: Tue, 12 Oct 2021 03:14:53 GMT [3] => Content-Type: application/json;charset=UTF-8 [4] => Content-Length: 117 [5] => Connection: keep-alive [6] => Server: nginx ) [_cookies:yii/httpclient/Message:private] => [_content:yii/httpclient/Message:private] => {"code":0,"data":{"end_offset":10100677,"start_offset":10100677,"transaction_id":781312034678068161},"msg":"SUCCESS"} [_data:yii/httpclient/Message:private] => [_format:yii/httpclient/Message:private] => [_events:yii/base/Component:private] => Array ( ) [_eventWildcards:yii/base/Component:private] => Array ( ) [_behaviors:yii/base/Component:private] => )
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/181730.html