I am using curl to send a GCM push notification. My code is similar to the answer in this question: GCM with PHP (Google Cloud Messaging) Now as a response (in the code $result) I get a JSON if its successful:
{"message_id":7575959326758153703}
And and HTML if there is an error:
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
How do I parse the error messages in PHP?