I make a call to get my response and info , and then print it to view all is ok.
$data = file_get_contents( [CALL TO API] );
$data = json_decode($data, true);
print("<pre>".print_r($data,true)."</pre>");
If the call is good, I will get my result no problem. but while testing, I need to know when it fails and why.
In the online test demo area, I will get this if it fail's.
{
"error": {
"errors": [
{
"domain": "youtube.subscription",
"reason": "subscriptionForbidden",
"message": "The requester is not allowed to access the requested subscriptions."
}
],
"code": 403,
"message": "The requester is not allowed to access the requested subscriptions."
}
}
But I only get a plank page.
So I then decided to look at my return header with
var_dump(headers_list());
var_dump(http_response_code());
This gives me
array(1) { [0]=> string(23) "X-Powered-By: PHP/5.4.7" }
int(200)
As you see, it is giving me a "200" OK header, but not much else.
So how can I see what the youtube DEMO page shows me?
This would also be helpful later on for error checking when my site is finished.