Posts

How to create or add cookie value by javascript?

<script type="text/javascript"> function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } call this function to create cookie  like below setCookie("cookie_name",value,365); if you dont want delete a cookie after a several time then place 0 zero on exdays(356) </script>

Uncaught exception in Google authentication in apiOAuth2.php and apiOAuth2->setAccessToken('{? "access_tok...') error

In this google+ api there is main poblem when ever you use api code it shows some uncaught error. like : apiOAuth2->setAccessToken('{? "access_tok...') Or Fatal error : Uncaught exception 'apiAuthException' with message 'Invalid token format' in /home/project/public_html/gplus/src/auth/apiOAuth2.php:109 Stack trace: #0 /home/project/public_html/gplus/src/auth/apiOAuth2.php(74): apiOAuth2->setAccessToken('{? "access_tok...') #1 /home/project/public_html/gplus/src/apiClient.php(130): apiOAuth2->authenticate(Array) #2 /home/project/public_html/gplus/gplus_login.php(15): apiClient->authenticate() #3 /home/project/public_html/gplus/index.php(9): include('/home/project/...') #4 {main} thrown in /home/project/public_html/gplus/src/auth/apiOAuth2.php on line 109 and it will not work on localhost in ..src/auth/apiOAuth2.php file you have the code $accessToken = json_decode($accessToken, true); if (! isset($acces