GCM Implementation using PHP always facing Unauthorized Error 401

后端 未结 3 1007
小蘑菇
小蘑菇 2020-12-21 09:19

I am always getting 401 error.Please any one could let me know exactly what should be HTTP referrers if i am using my local server. i.e Currently I am using:



        
3条回答
  •  抹茶落季
    2020-12-21 09:42

    I can see several errors:

    1. Contenttype:application/json should be Content-Type: application/json.
    2. You forgot to include the registration ids in the JSON.
    3. I'm not sure if CURLOPT_SSL_VERIFYPEER => false and CURLOPT_SSL_VERIFYHOST => false are required.

    You can find many PHP GCM samples that work (for example - here).

提交回复
热议问题