Posts

Login with google plus

<html lang="en"> <head> <meta name="google-signin-scope" content="profile email"> <meta name="google-signin-client_id" content="44813260673-o4ubmoa9vg5mm62mumthfulmonnj1198.apps.googleusercontent.com"> <script src="https://apis.google.com/js/platform.js" async defer></script> <meta charset="utf-8"> <script> function onSignIn(googleUser) { // Useful data for your client-side scripts: var profile = googleUser.getBasicProfile(); console.log("ID: " + profile.getId()); // Don't send this directly to your server! console.log('Full Name: ' + profile.getName()); console.log('Given Name: ' + profile.getGivenName()); console.log('Family Name: ' + profile.getFamilyName()); console.log("Image URL: " + profile.getImageUrl()); console.log("Email: ...

Scrape the data in PHP

How to Scrape the data form website using CURL? To scrap the data from website, Website must be public and open for scrapable. In the following code, just update the URL to which websites data you want to scrap. <?php $s = curl_init(); curl_setopt($s,CURLOPT_URL,"http://www.domain_name.com/"); curl_setopt($s,CURLOPT_RETURNTRANSFER,1); curl_setopt($s,CURLOPT_HEADER,0); $op = curl_exec($s); curl_close($s); echo $op; ?>

File upload using ajax in php

upload.php   <!DOCTYPE html> <html> <head> <title>Image Upload Form</title> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> function submitForm() { console.log("submit event"); var fd = new FormData(document.getElementById("fileinfo")); fd.append("label", "WEBUPLOAD"); $.ajax({ url: "www.stcodewriter.com/get_upload.php", //put your get file path here type: "POST", data: fd, processData: false, // tell jQuery not to process the data contentType: false // tell jQuery not to set contentType }).done(function( data ) { console.log("Output:"); console.log( data ); }); return false; } </script> </head> <body> ...

Remove .php Using .htaccess File

# Apache Rewrite Rules  <IfModule mod_rewrite.c>   Options +FollowSymLinks   RewriteEngine On   RewriteBase /   # Add trailing slash to url   RewriteCond %{REQUEST_FILENAME} !-f   RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$   RewriteRule ^(.*)$ $1/ [R=301,L] # Remove .php-extension from url   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME}\.php -f   RewriteRule ^([^\.]+)/$ $1.php #For error page RewriteCond %{REQUEST_URI} ^/404/$ RewriteRule ^(.*)$ /errors/404.php [L] RewriteCond %{REQUEST_URI} ^/503/$ RewriteRule ^(.*)$ /errors/503.php [L]

How to use AngularJS in PHP?

* Simple Example: /* ******* Start *** *** / "ajdemo.php" <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body> <div ng-app=""> <p>Input something in the input box:</p> <p>Name: <input type="text" ng-model="name"></p> <p ng-bind="name"></p> </div> </body> </html> /***** End *******/ * With Simple html and PHP: /***** Start *******/ "ajForm.html" <!DOCTYPE html> <html ng-app="formExample"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="...

How to insert Gujarati or other langauges data to mySQL?

-> First of all create any database then execute below queries: CREATE TABLE `multi_lang` (`data` varchar( 1000 ) CHARACTER SET utf8 COLLATE utf8_bin default NULL); INSERT INTO `multi_lang`VALUES ('ગુજરાતી'); Now see your table data.

Change Date Format

<?php $date = "18/11/2015"; $change_date = str_replace('/', '-', $date); echo $result_date = date('Y-m-d', strtotime($change_date)); ?> //output: 2015-11-18