Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Generate Short Bitly Url

Here's how you can create short URLs using Bit.ly services /* returns the shortened url */ function get_bitly_short_url($url,$login,$appkey,$format='txt') { $connectURL = 'http://api.bit.ly/v3/shorten?login='.$login.'&apiKey='.$a...

difference between PHP isset() vs empty() vs is_null()

PHP has different types of built-in functions which can be used to check the value of a variable. Basically there are three useful functions you can use for test the value of a variable i.e. isset(), empty() and is_null(). All these php function ...

Submitting a form via curl

Hers's is the tutorial to submit form via curl. I am taking example of log in form for say xyz.com site. $ch = curl_init(); if($ch){ $url = 'http://www.xyz.com/logmein.php'; $postdata = array('LoginButton' => "Logon", ...

WAMP 2.2 configuration problem with php_curl

I installed new wamp on windows 7. It has some dependency on some microsoft tool "vcredist_x64.exe". My installation was successful and I enabled php_curl extension from php settings but I was still getting : Call to undefined function curl_ini...

Get the title and meta tags from a url in php

To get the title and meta tags from a website you can use the following code : <html> <head> </head> <body> <?php function getTitle($Url){ $str = file&#95;get&#95;contents($Url); if(str...

how to make URL in php using http_build_query

/* suppose we have an array consist of 4 or more than that parameters then in order to pass these parameters to URL then we can use http_bhild_query as follows */ $data = array('city'=>'delhi', 'cloth'=>'dress', ...

Service center congestion in telesign mobile sms gateway

Hi all, I am using telesignmobile sms gateway for one of my website. Everything was working properly but suddenly sms sending was stopped and I was getting "Service center congestion" in my status report. I googled it and found nothing. Then ...

Scrapping - get Select option values and text via simple html dom

Here is the working example to get select box option value and text via Simple html dom. I assume that you have already included simple_html_dom file and have html content in $content variable $html = new simple_html_dom(); // Creating htm...

Setting up your system as virtual host using WAMP

if anyone configure's virtual hosts on WAMP server helps to run as many separate sites as you want.This includes following quick steps 1.Go to "C:/Windows/System32/drivers/etc" and open the "hosts" file in Notepad. At the bottom of the hosts f...

What Is The Diffrence Between Do And Do While Loop

The Main Difference Between Do And Do While Loop Is :- Do while Loop :- If we use "Do While" at least one time execute the loop and then check the Condition. While Loop:- When we Use "While" then firstly check the condition after execute ...

Configure and customize leaflet map in Drupal 7

Hi, Leaflet module provides a javascript library for mapping leaflet map into Drupal and can be downloaded from https://drupal.org/project/leaflet We can initialize map from our custom module as follow: $map_info = leaflet_map)get_info('...

How to upload file in PHP

<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <form action="upload.ph...

How add a toggle button for active inactive in Yii CGridView

How add a toggle button for active inactive in Yii CGridView <?php $this->widget('zii.widgets.grid.CGridView', array( 'id'=>'subject-grid', 'dataProvider'=>$model->search(), 'columns'=>array( 'id', ...

Snapshot of any website from its URL

Get the snapshot of any website in php without writting a script <html> <head> <!--[if IE]> <style> #frame { zoom: 0.2; } </style> <![endif]--> </head> <body> <div class="test...

Getting the Code of any site using php script

Open the code view of any site : <?php $lines = file('http://www.whoznext.com/'); //Site url foreach ($lines as $line&#95;num => $line) { // iterate through each line echo "Line #{$line&#95;num} : " . htmlspecialchars($line...

change time format from 24 hours to 12 hours

Following is the function to change time format from 24 hours to 12 hours, please take a look at input and output examples before you use it /* * Return: 24 hours format to 12 hours format * Input example: 1400, 730, 1205, 0 * Ouput e...

How to inherit the properties and methods of base class to the child class in php

<?php class data<br> {<br> public $firstno;<br> public $secondno;<br> public function getData($fno,$sno)<br> {<br> $this->firstno=$fno;<br> $t...

Passing an array to the URL

Sometime you may need to pass the array in the url. You can do this as following: <?php $array["a"] = "A"; $array["b"] = "B"; $array["c"] = "C"; $array["d"] = "D"; $str = serialize($array); $strenc = urlencode($str); print $str ....

How use auth login in different model in cakephp

How use auth login in different model in cakephp public $components = array('Session', 'Cookie', 'Auth' => array( 'authenticate' => array('Form' => array( 'userModel' => 'Admin', 'fields' ...

Create new html tag in Drupal

Sometimes we need to use some unique tags which are not available in HTML. For this we can just use these tags in our html coding, but in some specific cases our browser will not display them because these are not identified and comes within "<...

How to make UL/LI tree from a normal array

We usally wants to male a ul/li tree from an array having parent id within each individual record : $subjecttopic=Array ( [0] => Array ( [id] => 52b28146f484a5a410000029 [name] => Addtion ...

Internationalization of cakephp site

Internationalization of cakephp site: STEP 1) Write the following code in cakePhp routes.php file Router::connect('/:language/:controller/:action/*', array(), array('language' => '[a-z]{3}')); ...

How to debug MYSQL database Issue while using DatePicker

As we all know that MYSQL (phpmyadmin) database require " YYYY-MM-DD " format while saving a certain DATE . So if we are using Datepicker we have to adjust the date format. $(function() { $( "#datepicker" ).datepicker({ dateFo...

Write text on image

Here is the code to write text on the image:- shell_exec("convert /var/www/html/james/final.png -font /var/www/html/james/tahomabd.ttf -pointsize 85 -density 100 -fill indigo -draw 'text 475,440 JAMES' /var/www/html/james/james1.png"); ...

Using Ternary operator instead of If/Else in Php

Evaluating If Else statements is very common in programming paradigm. But 'If Else' statements are long and they can be easily replaced by simply using Ternary operators. Here is a tutorial on the usage of ternary operators and their implementati...

Concept Of AJAX

AJAX----- Asynchronous JavaScript and XML. We use AJAX when we are using the concept of " B to B " or "B to C" B to B -- business to business ........................................// user to website. B to C -- business to costumers...........

Get user FB friends data by itsa access token in php

By knowing the token value and fbid we can get the data of friends in a file which we can use use further in our code. For example: $post_decode = $this->request->input ( 'json_decode', true) ; $fbid = $post_decode['fbi...

Extract method in PHP

Sometime we may need to use the same variable name that you are using in the query or simply in an associative array. Lets say you have an associative array : $arr = array( 'totalLimit' => 50, 'limit' => 10 ); The usually what we...

Using HeroDocs in php

Herodocs are useful for multi-line strings and avoiding quoting issues. It prevents from escapinging of characters in php EX1 ) $sql = <<<SQL select * from TABLE_NAME where id =1 and product_name = "widgets" SQL; O/...

Learn How To Do Logout using PHP Session

/* A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application.*/ Two things are to be kept in mi...

Introduction to php

<html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html> PHP(Hypertext Prepr...

How to create a class and object in php

class rect { public $length=0; public $width=0; public $area=0; public function getData() { $this->length=10; $this->width=20; } public function area() { $this->area = $this->leng...

Problem with foreach loop for updating array element

If we are traversing an array and need to update an element in some condition then it is quite tricky to do that in foreach loop. For example, if we need to increase each element by 2 of an integer array then we can do that using for loop in t...

Jquery vallidator rule for filling at least one field between a group

<script type="text/javascript"> $(document).ready(function() { jQuery.validator.addMethod("require_from_group", function (value, element, options) { var numberRequired = options[0]; var selector = options...

Parsing CSV file using php SplFileObject class.

The SplFileObject class provides an object oriented interface for a file. $file="upload_file.csv"; //file to parse Steps: 1) Create SplFileObject class object to the csv file. $srcFile = new SplFileObject($file); 2)Now loop ti...

Generate random number of specific length in php

To generate random number of specific length let the length be 10 we write <?php $random_number = rand(1000000000,9999999999); echo $random_number; ?>

Kohana issue on GoDaddy Shared Hosting

Recently while working for a project I faced an issue while making the site live. The site was developed with kohana framework and was to be hosted on Godaddy Server (Shared Hosting) and I faced a peculiar issue on the server giving me an erro...

Hide div by slide effect and show another div

This code is used to hide div by slding effect towards right to left and show another div by the same sliding effect on its place . <script src="js/jquery.min.js" language="javascript" type='text/javascript'></script> <script...

Checking the date entered is according to a predefined format or not ?

Checking the date entered by the user correct of not as according to a predefined format or not. Example 1) $format = 'd-m-Y'; $input = 'asasasawasa-sldjs'; $date = DateTime::createFromFormat($format, $input); if($date) echo '...

How to create profile url in cakephp?

Hello readers ! Few days back I was facing issue to make public profile page in cakephp. And want to hide controller and action name from url for this I used the below code in routes.php and its work fine. Router::connect( '/:usernam...

Write text on video

Here is the function that tells how to write text on any sample video:- function videoConversion($videoId, $batchId){ $font_path = "/var/www/html/james/LeagueGothic-Regular.otf";//path of the fonts $ffmpeg_path = "/...

Call ajax function on autocomplete in jquery

<h2>//Call ajax function on autocomplete in jquery</h2> $(document).ready(function(){ jQuery("#name").autocomplete({ source: function(request, response) { $.ajax({ url: 'include/get.php',...

Get group id and check membership from node id in Drupal 6

We can get group information and also can check membership in that group from current logged in user, using following code: $gidarray = array_keys($node->og_groups); $gid = $gidarray[0]; global $user; if(og_is_group_member($gid, true, $u...

Table layout structure while generating html to pdf using html2pdf library

After dealing with html2pdf library,I found that if we are trying to generate html to PDFs for more than one page never use nested table layout structure.in order to avoid this error "The content of a TD tag does not fit on only one page "..Inst...

Difference between array_slice() and array_splice()

**array_slice() Vs array_splice()** What arrayslice() function do: As name suggest this function just return part/slice of array which we pass to arrayslice() function as parameter 1 depending u...

Login either Username or Email using Authentication Plugin in Joomla

With the help of this Plugin user can login either with email or username . This plugin is compatible with Joomla 1.5, Joomla 2.5 and Joomla 3.1 . How to install Login to Joomla Administrator. Install with Joomla installer Proceed to y...

PHP array to JavaScript array conversion

Sometimes, I feel a need to get a PHP array in my JavaScript code. Earlier I make use of implode function of php but recently found new way using json_encode that works very effectively. Here is my php array: <?php $cool_epl_clubs_php =...

Sending xml data in post using curl

$xmldata =' <mail> <receive>you</receive> <sender>Surit</sender> <subject>Call me</subject> <message>XYZ</message> </mail> '; $url = "your url"; $curlConn = curl_init($url)...

compact() or set() in cakephp

set() is the way to set values in your controller and get those values in your view file. Syntax of set is-> $this->set('variable','value') In cake-php controller you can set the values as - set('variable1','value1'); $this->...

Add placeholder in Drupal form api fields

Hi all, Sometimes we need to add placeholder in our form fields but it get little bit complex when it comes to form api under Drupal CMS. There is no hard coded form fields in drupal (In case of content and comment forms), everything is com...
1 43
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: