求助帖,请求 API 后怎么获取返回的 http 状态码
直接上问题:
$result = $client->push()
->setPlatform('all')
->addAllAudience()
->setNotificationAlert('Hi, JPush')
->send()
上面的代码调用了极光推送的推送代码,他的正确的返回信息是这个
HTTP/1.1 200 OK
{
"time_unit":"DAY",
"start":"2014-06-10",
"duration":3,
"items":[{"time":"2014-06-10"},
{"time":"2014-06-11","android":{"active":1}},
{"time":"2014-06-12","android":{"active":1,"online":2}}]
}
错误的返回信息是这个
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": {
"code": 3001,
"message": "Basic authentication failed"
}
}
问题来了,我该怎么获取到http状态码呢,我使用的框架是 laravel
用的这个包吗 https://github.com/jpush/jpush-api-php-cli... ?
打印下:
被封装起来了,取不到,最终返回时这段调用 https://github.com/jpush/jpush-api-php-cli... :
所以,https://github.com/jpush/jpush-api-php-cli...