Ios Push notification script

<?php class PushNotifications { // (iOS) Private key’s passphrase. private static $passphrase = ‘1234’; // Change the above three vriables as per your app. public function __construct() { exit(‘Init function is not allowed’); } // Sends Push notification for iOS users public function iOS($data, $devicetoken) { $deviceToken = $devicetoken; $ctx...Read more …

Get actual URL in Cakephp without replacing plus (+)

In Cake PHP If URL has plus(+) sign, and get url with $this->params. then + will be raplced with space. SO for getting actual URL just change your .htaccess Go to app/webroot/.htaccess replace RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] to RewriteRule ^(.*)$ index.php?url=$1 [QSA,L,B]Read more …

Extract is your friend

Use of extract function, For example, generally how we use varibles. $name = $_REQUEST[‘name’]; $surname = $_REQUEST[‘surname’]; $message = $_REQUEST[‘message’]; So, instead of defining as above , we can use extract($_REQUEST); Will automatically make $name = $_REQUEST[‘name’]; So, you can say “hello “.$name.” “.$surname.” without doing all the declarations.Read more …

Rewrite rule with ‘question mark (?)’

For using ‘question mark ‘ in rewrite rule first, we have to apply RewriteCond  with %{QUERY_STRING}. because we can’t use ‘question mark’ directly in Rewriterule. Try with below code http://www.example.com/products/title1/title2/?id=5 So, to create above URL, we can use below code #RewriteCond %{QUERY_STRING} ^id=(.*)$ #RewriteRule ^products/(.*)/(.*)/?$ products.php?ac=viewProduct&id=%1&cid=0 [L]Read more …