<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3367788962846719795</atom:id><lastBuildDate>Fri, 08 Nov 2024 15:12:47 +0000</lastBuildDate><category>file_get_contents</category><category>api Integration</category><category>curl</category><category>httpapi.com</category><category>php</category><category>mysql</category><category>array</category><category>codeigniter</category><category>curl_setopt</category><category>customer httpapi</category><category>echo</category><category>foreach</category><category>framework</category><category>header</category><category>json_decode</category><category>meta tags</category><category>php decrypt</category><category>php encrypt</category><category>secure php script</category><category>sql injection</category><category>sub reseller httpapi</category><category>$_SESSION</category><category>Compressed XML Sitemaps</category><category>DOMDocument</category><category>InnoDB</category><category>MYISAM</category><category>PHP 5.6 Released</category><category>PHP Security</category><category>alpha-2 code</category><category>analyze website using google api</category><category>array_unique</category><category>authenticating token httpapi</category><category>blob field</category><category>check domain name</category><category>company search in linkedin</category><category>connect odbc via php</category><category>country code</category><category>cpanel api</category><category>create data uri</category><category>cross site scripting</category><category>curl_init</category><category>customer token httpapi</category><category>data uri</category><category>decrypt in php</category><category>delete html with php</category><category>encrypt decrypt php</category><category>encrypt in php</category><category>essential php security pdf</category><category>expire php session</category><category>explode</category><category>extract meta tags</category><category>generate a token httpapi</category><category>generate file</category><category>generate qr code</category><category>get ip php</category><category>get meta tags php</category><category>get_html_translation_table</category><category>get_meta_tags</category><category>google</category><category>google api</category><category>google map</category><category>grab ip</category><category>gzencode</category><category>handle csv</category><category>htaccess</category><category>htaccess tips</category><category>http status</category><category>httpapi customer register php</category><category>image color</category><category>image data uri</category><category>image in blob</category><category>laravel</category><category>latitude</category><category>linkedin group search</category><category>linkedin php api company search</category><category>loading time</category><category>longitude</category><category>manage csv php</category><category>mb_detect_encoding</category><category>microsoft</category><category>mkdir</category><category>odbc_connect</category><category>odbc_fetch_row(</category><category>page rank by google</category><category>pagerank</category><category>pagespeed insight api</category><category>parse website</category><category>pdf</category><category>php 5.6</category><category>php array</category><category>php csv</category><category>php curl</category><category>php curl post data</category><category>php curl xml</category><category>php docx</category><category>php gallery</category><category>php get data uri</category><category>php ip address</category><category>php odt</category><category>php preg_replace</category><category>php security best practices</category><category>php security book</category><category>php security checklist</category><category>php security issues</category><category>php security pdf</category><category>php security tips</category><category>php security tutorial</category><category>php session</category><category>php website page rank</category><category>php xml</category><category>php xss</category><category>php year count down</category><category>php7</category><category>ping php</category><category>post data php</category><category>preg_split</category><category>print_r</category><category>promo prices httpapi</category><category>qr code curl</category><category>qr code php</category><category>redirect with php</category><category>resize image photo</category><category>screen capture website php</category><category>secure php</category><category>server</category><category>session_destroy</category><category>session_unset</category><category>simple decrypt</category><category>simple encrypt</category><category>site page rank</category><category>sitemap.xml.gz</category><category>sql</category><category>take webpage screenshot</category><category>text image php</category><category>title tag</category><category>unwanted tags</category><category>url page rank</category><category>utf8_decode</category><category>wordpress</category><category>xml curl</category><category>xml data php</category><category>xml php</category><title>4everTutorials</title><description>Online PHP Examples with Source Code</description><link>http://4evertutorials.blogspot.com/</link><managingEditor>noreply@blogger.com (Web master)</managingEditor><generator>Blogger</generator><openSearch:totalResults>117</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-1485654558346294730</guid><pubDate>Fri, 15 Apr 2016 06:44:00 +0000</pubDate><atom:updated>2016-04-15T12:14:11.396+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">microsoft</category><category domain="http://www.blogger.com/atom/ns#">php</category><category domain="http://www.blogger.com/atom/ns#">php7</category><category domain="http://www.blogger.com/atom/ns#">server</category><category domain="http://www.blogger.com/atom/ns#">sql</category><title>PHP 7 with Microsoft SQL Server Driver Released</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img border=&quot;0&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX_QOXSZLJKju09d1_DyMWI3_ZeTY29DoC7e15Bfw8ADLT0laEeKL8_5Kfs4EsdivOwN1YfJWcDT3h_qfofELPq62Zz2m8_NDwpGTh8abplhtsFismZL3SagLbekg-k_W-7IwV_f8wM-yR/s400/PHP-7-with-Microsoft-SQL-Server-Driver-Released-4evertutorials.jpg&quot; width=&quot;400&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Microsoft announced on 12th April 2016&amp;nbsp;early technical preview of the Microsoft Driver 4.0.3 for &lt;strong&gt;PHP for SQL Server&lt;/strong&gt;,
 using this driver you can connect your PHP&amp;nbsp;application with Microsoft 
SQL Server currently this server is available only for PHP 7. This 
Driver enable you to access SQL Server,&amp;nbsp;Azure SQL Database and Azure SQL
 DW from your&amp;nbsp;PHP 7 apps.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://github.com/Azure/msphpsql/releases/tag/v4.0.0&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Download Driver&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;strong&gt;Future Plans&lt;/strong&gt;&lt;/h2&gt;
Microsoft&amp;nbsp;plan on a Linux port, expand SQL 16 Feature Support 
(example: Always Encrypted), build verification/fundamental tests, bug 
fixes.&lt;br /&gt;

This early technical preview provide some limited support on this github page &lt;a href=&quot;https://github.com/Azure/msphpsql/issues&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
We hope this add-on will help you in your future development. &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&lt;b&gt;Source&lt;/b&gt;: https://blogs.msdn.microsoft.com/sqlphp/2016/04/12/early-technical-preview-of-microsoft-drivers-4-0-3-for-php-for-sql-server-released/&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2016/04/php-7-with-microsoft-sql-server-driver.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX_QOXSZLJKju09d1_DyMWI3_ZeTY29DoC7e15Bfw8ADLT0laEeKL8_5Kfs4EsdivOwN1YfJWcDT3h_qfofELPq62Zz2m8_NDwpGTh8abplhtsFismZL3SagLbekg-k_W-7IwV_f8wM-yR/s72-c/PHP-7-with-Microsoft-SQL-Server-Driver-Released-4evertutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-4125218396031258024</guid><pubDate>Fri, 04 Mar 2016 02:48:00 +0000</pubDate><atom:updated>2016-03-04T08:18:31.266+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">codeigniter</category><category domain="http://www.blogger.com/atom/ns#">framework</category><category domain="http://www.blogger.com/atom/ns#">laravel</category><title>Different between CodeIgniter and Laravel frameworks</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img alt=&quot;Different between CodeIgniter and Laravel frameworks&quot; border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbSHsXG7Az9Yc-RmSz6R3nHcTVEL_dEzfJ0MNVX9A5FYAkGZ48TfAYy_BLk-jbjIq_XYT_XsvkZ8MowGyfsON_wyVIyBqJyhxF0vs49vC2uN_irzXP88Zx8Wbk_4DBE3toAlNLH0HB3XmR/s640/Different+between+CodeIgniter+and+Laravel+frameworks.png&quot; title=&quot;Different between CodeIgniter and Laravel frameworks&quot; width=&quot;640&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Here, let us make a brief analysis and know the differences between Laravel and CodeIgniter.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Laravel pros and cons&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It is common knowledge that, for web application development, Laravel offers expressive, elegant syntax. Such has been its design. The laravel developer will enjoy the development process. Routing, authentication, sessions are some tasks, which are commonly performed, and are made easier, thanks to Laravel.&lt;br /&gt;&lt;br /&gt;Importantly, this framework is designed for the PHP&#39;s latest version. Therefore, unit testing support and authentication, which are the base development components, are inbuilt. It is commendable that Laravel framework folds with the blade template engine in a smooth manner.&lt;br /&gt;&lt;br /&gt;One area where Laravel outdoes CodeIgniter is it has got exceptions. These, with exceedingly detailed stacktrace aren&#39;t available for developers who use CodeIgniter..&lt;br /&gt;&lt;br /&gt;Use of libraries and models is easier as Laravel has object-oriented libraries. These libraries are supported with autocomplete feature.&lt;br /&gt;&lt;br /&gt;Laravel has its own command-line interface. Called as Artisan, it enables developers to perform abundant tasks. So what tasks? Tasks like migrating databases and seeding databases. Also performed is clearing the cache, etc.&lt;br /&gt;&lt;br /&gt;Object-Relational Mapping or ORM in Laravel is simple, eloquent and fast. That said, developers will find it very easy to organize the application&#39;s database.&lt;br /&gt;&lt;br /&gt;Laravel is best suited for building RESTful APIs. Apart from that, Laravel handles event queuing.&lt;br /&gt;&lt;br /&gt;However, Routing in Laravel may be odd at times. Owing to the recent entry of Laravel, it may be a bit tougher if not altogether, to get to find answers. Notwithstanding this fact, the numerous forums and IRC are very much active in helping people find answers. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CodeIgniter pros and cons&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;It is simple, and also quick to set up CodeIgniter. Just download the preferred version from CodeIgniter homepage. Otherwise, from GitHub. Thereafter, unzip the contents.&lt;br /&gt;&lt;br /&gt;Nothing can beat CodeIgniter in terms of documentation, which is clear and very well structured. It is such that all the particular concepts of CodeIgniter which are commonly used are explained clearly, that too, with examples.&lt;br /&gt;&lt;br /&gt;CodeIgniter is stable. The popular framework has the advantage of having been tested by the developers in large number. Having said that, the chances of bugs or any other problems going unnoticed is minimal.&lt;br /&gt;&lt;br /&gt;The templating engine, which is inbuilt in CodeIgniter, is easy to use and is based on mustache-like templating language. Learning this language is simple even for new developers.&lt;br /&gt;&lt;br /&gt;No matter whether you know anything about MVC architecture or not; it is very easy to use CodeIgniter.&lt;br /&gt;&lt;br /&gt;CodeIgniter offers output caching. Web pages can be cached so that the loading time can be reduced. Besides, efficiency and performance can be enhanced.&lt;br /&gt;&lt;br /&gt;Developers using CodeIgniter can easily seek support. Because this framework has a very big community which uses the framework for smaller projects and also very large projects.&lt;br /&gt;&lt;br /&gt;It may be an overstatement to call CodeIgniter obsolete. However, it is to be noted that the framework has been released at the time of PHP 4. Many new features were added later to PHP. Hence, the need for extending code files arises to make this framework work.&lt;br /&gt;&lt;br /&gt;Another drawback of CodeIgniter is that it does not offer default modular separation.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Both frameworks, which are unique and similar in many ways have their own set of advantages and disadvantages. However, it is the requirements of the developers that decide which is to be preferred. All that said, if you are a developer working on modern apps, it is suggested you go for Laravel. Every Laravel developer company attributes their ease of web development to this framework.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2016/03/different-between-codeigniter-and-laravel.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbSHsXG7Az9Yc-RmSz6R3nHcTVEL_dEzfJ0MNVX9A5FYAkGZ48TfAYy_BLk-jbjIq_XYT_XsvkZ8MowGyfsON_wyVIyBqJyhxF0vs49vC2uN_irzXP88Zx8Wbk_4DBE3toAlNLH0HB3XmR/s72-c/Different+between+CodeIgniter+and+Laravel+frameworks.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-5654311251894532888</guid><pubDate>Wed, 10 Jun 2015 09:51:00 +0000</pubDate><atom:updated>2015-06-10T15:22:18.433+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">explode</category><category domain="http://www.blogger.com/atom/ns#">loading time</category><title>Get webpage loading time using PHP</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7hWchOf6akIDk9smagkwl9YCVo0EovGWk-f_UhOnyg4P3gZXVnJ6w8a3fGEspn3G1lylDxAsSQKLA0tdRDNfBjvgSI0e8DCRfcp65nQhifvIfya9lDBEpHLOwuN-i_SGF9am1GLBhVKcC/s1600/Page+Loading+Time+4everTutorials.jpg&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Execution of server side scripting need to optimize in order to get the Optimized page loading time. In this case most of the Server Side Response typically not more than 2 to 30 seconds. In this case we need to find the Exact page loading time in PHP using the following Script.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

function page_loading_time()
{
    list ($msec, $sec) = explode(&#39; &#39;, microtime());
    $microtime = (float)$msec + (float)$sec;
    return $microtime;
}

$start=page_loading_time();

usleep(100000);  // Delaying page output 0.1 second for testing purpose.

echo &quot;
&quot;;
$end = page_loading_time();
// Print results.
echo &#39;Page Loading Time: &lt;b&gt;&#39; . round($end - $start, 2) . &#39;&lt;/b&gt; seconds&#39;;   


?&amp;gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://4evertutorials.blogspot.com/2015/06/get-webpage-loading-time-using-php.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7hWchOf6akIDk9smagkwl9YCVo0EovGWk-f_UhOnyg4P3gZXVnJ6w8a3fGEspn3G1lylDxAsSQKLA0tdRDNfBjvgSI0e8DCRfcp65nQhifvIfya9lDBEpHLOwuN-i_SGF9am1GLBhVKcC/s72-c/Page+Loading+Time+4everTutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-5653505366001706940</guid><pubDate>Fri, 29 May 2015 06:43:00 +0000</pubDate><atom:updated>2015-05-29T12:15:14.845+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">file_get_contents</category><category domain="http://www.blogger.com/atom/ns#">generate file</category><category domain="http://www.blogger.com/atom/ns#">mkdir</category><category domain="http://www.blogger.com/atom/ns#">php</category><title>Generate and save file in directory using PHP</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img alt=&quot;4everTutorials&quot; border=&quot;0&quot; height=&quot;215&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwZ36YrRgSOfL9V3aUGMQOKcjo5ElYT6ce29HE1dbvbl2TLxEtCdDK4wEv_2sNvkvn6TXOmYwnlrVtmKAlN7jjymsIl8HxlBfHT13Yt_VW2wZkMOWgYFZDATio1V5HUwWtNlyVFL5DV80m/s400/Generate+and+save+file+using+PHP+4evertutorials.jpg&quot; title=&quot;4everTutorials&quot; width=&quot;400&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
In this lesson we will see how to generate file and save into new directory using PHP. So we will generate a HTML, PHP or any other type of file and save it into a newly created or existed directory.&lt;br /&gt;
&lt;br /&gt;
Step 1: At first we have to select an existing directory or create a new directory by using mkdir() function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$dir_path = &quot;depth1/depth2/depth3&quot;;
 
mkdir($dir_path, 0777, true);

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Here, $dir_path is the path to the expected directory/folder of your hard drive.&lt;br /&gt;
And ’0777′ is the default permission of the folder/file (widest possible access).&lt;br /&gt;
&lt;br /&gt;
So, the file will be located in this directory: current_directory/depth1/depth2/depth3&lt;br /&gt;
&lt;br /&gt;
But if you want to create the folder outside the current directory, then use “../” for each level you want to go back for the new directory.&lt;br /&gt;
&lt;br /&gt;
For example, if your current directory is “C:\xampp\htdocs\cd” and you want to create the new folder inside “xampp” folder then you have to write like the following-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$dir_path = &quot;../../test&quot;;
 
mkdir($dir_path, 0777, true);

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
So, path for the new directory will be “C:\xampp\test”.&lt;br /&gt;
&lt;br /&gt;
Step 2: After creating the directory simply put the generated file to the directory by using file_put_contents() function.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

file_put_contents($dir_path.&quot;/name-of-file.html&quot;, $content);
file_put_contents($dir_path.&quot;/name-of-file.php&quot;, $content);
file_put_contents($dir_path.&quot;/name-of-file.txt&quot;, $content);

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Here, name-of-file is the expected name of your file and $content is the the data that you want to save in the file.&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2015/05/generate-and-save-file-in-directory.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwZ36YrRgSOfL9V3aUGMQOKcjo5ElYT6ce29HE1dbvbl2TLxEtCdDK4wEv_2sNvkvn6TXOmYwnlrVtmKAlN7jjymsIl8HxlBfHT13Yt_VW2wZkMOWgYFZDATio1V5HUwWtNlyVFL5DV80m/s72-c/Generate+and+save+file+using+PHP+4evertutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-2241049443047430086</guid><pubDate>Thu, 07 May 2015 09:14:00 +0000</pubDate><atom:updated>2015-05-07T15:00:16.841+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">text image php</category><title>Text rasterization service script using php</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;This is an example of using Gd / FreeType to generate image text labels with TTF font. Provided script could be used as &quot;text rasterization service&quot; to generate arbitrarily text-images for a web site. MD5-based authorization is used to avoid image generation by unauthorized users.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Compatible with:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;PHP 5 or higher&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;PHP 4.1 or higher&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Gd 2.x, FreeType support in PHP&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Our &quot;text rasterization service&quot; does the following:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Receives text generation parameters(text and font-size) and md5 sign of secret key + parameters.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Checks(by md5 sign) if rasterized text image exists in cache directory. If so, sends it to web browser and quits.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Checks md5 authorization: computes md5 of secret key + parameters. If computed md5-sign equals to provided md5-sign, then request is valid. Otherwise — somebody else is trying to use our &quot;text rasterization service&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Generates text image with imagettftext. Image size exactly matches text size (using imagettfbbox)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;Sends generated image to browser&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;So, it is possible to automatically generate a lot of image text labels for a whole web site. Caching technique will decrease server load: images would be generated only once.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

// Checking for gd and Freetype support 
if (!function_exists(&#39;gd_info&#39;))
  die(&#39;No &lt;a href=&quot;http://ua.php.net/manual/en/ref.image.php&quot;&gt;gd&lt;/a&gt; support in PHP.&#39;);

$gd = gd_info();
if ($gd[&quot;FreeType Support&quot;] == false)
  die(&#39;No FreeType support in gd&#39;);

// If you&#39;re sure about gd &amp; freetype support
// -- comment out this block 



// directory for caching generated images 
// should be writable 
$cache_dir = &#39;/home/path/to/cache&#39;; // DO NOT FORGET TO CHANGE


// testing cache dir 
// remove these lines if you&#39;re sure 
// that your cache dir is really writable to PHP scripts
$tf = $cache_dir.&#39;/&#39;.md5(rand()).&quot;.test&quot;;
$f = @fopen($tf, &quot;w&quot;);
if ($f == false)
    die(&quot;Fatal error! {$cache_dir} is not writable. Set &#39;chmod 777 {$cache_dir}&#39; 
           or something like this&quot;);
fclose($f);
unlink($tf);
// testing cache dir END 




// full path to preferred TTF font 
// you could change this to be HTTP parameter 
$font = &#39;/home/path/to/font/FuturaBook.ttf&#39;; // DO NOT FORGET TO CHANGE


// md5 secret 
$md5_secret_key = &#39;changeme&#39;; // DO NOT FORGET TO CHANGE


// md5 sign of parameters
$auth_sign = isset($_GET[&#39;a&#39;])?$_GET[&#39;a&#39;]:&#39;&#39;;

// checking for cached file:
$cache_file = $cache_dir.&#39;/&#39;.$auth_sign.&#39;.png&#39;;

if (file_exists($cache_file))
{
  // if cached file exists
  // output it and quit
  header(&quot;Content-type: image/png&quot;);
  readfile($cache_file);
  exit();
}

// no cached file exists 


// input parameters: text and size 
$text = isset($_GET[&#39;text&#39;])?$_GET[&#39;text&#39;]:&#39;default&#39;;

$font_size = isset($_GET[&#39;size&#39;])?intval($_GET[&#39;size&#39;]):30;
if ($font_size == 0) $font_size = 30;
// 


// basic sign checking: 
$computed_sign = md5($md5_secret_key.$text.$font_size);
// computing md5 sum of concatenation 
// of secret key and parameters

// hmac-based alrorithm would fit this case more 
// but for real-world purpose md5 of concatenation
// is enought 

if ($computed_sign != $auth_sign)
  die(&#39;Auth failed&#39;); // auth error, provided sign is invalid 


// getting bounding box 
$bbox = imagettfbbox($font_size, 0, $font, $text);
// imagettfbbox returns very strange results 
// so transforming them to plain width and height 

$size_w = abs($bbox[2] - $bbox[0]);
// width: right corner X - left corner X

$size_h = abs($bbox[7] - $bbox[1]);
// height: top Y - bottom Y

// This is a lower-left corner 
// but imagettfbbox() sets (0,0) point
// inside bounding box
// so we shifting lower-left corner
$x = -abs($bbox[0]); 
$y = $size_h - abs($bbox[1]);

$im = imagecreatetruecolor($size_w, $size_h);
// creating image

$back = imagecolorallocate($im, 255, 255, 255); // background color
$fore = imagecolorallocate($im, 0, 0, 0); // foreground color

imagefilledrectangle($im, 0, 0, $size_w - 1, $size_h - 1, $back);
// filling with background color

imagettftext($im, $font_size, 0, $x, $y, $fore, $font, $text);
// rendering text

imagepng($im, $cache_file); // outputing PNG image to file cache 

imagedestroy($im); // destroy image 


// sending data from cache file 
header(&quot;Content-type: image/png&quot;);
readfile($cache_file);


?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
 &lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;To generate image &#39;Hello World&#39;, 90 pixels size you should call this script as (assuming you&#39;ve saved it as font.php):&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&amp;lt;img src=&quot;./font.php?text=Hello+World&amp;amp;size=90&amp;amp;a=4c9a240e98490275d845c96fdb8e5a19&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;b&gt;Note&lt;/b&gt; parameter &#39;a=4c9a240e98490275d845c96fdb8e5a19&#39;. &#39;4c9a240e98490275d845c96fdb8e5a19&#39; is a result of md5(&#39;changemeHello World90&#39;): concatenation of secret key, text and font size. &lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;You could use some helper function to set script arguments, like &#39;image_params&#39;: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$md5_secret_key = &#39;changeme&#39;;

// returns parameters and md5 sign for 
// text generating service
function img_params($text, $size) 
{
  global $md5_secret_key;
  $p = &#39;?text=&#39;.urlencode($text).&#39;&amp;size=&#39;.$size.&#39;&amp;a=&#39;;
  return $p.md5($md5_secret_key.$text.$size);
}

?&amp;gt;

&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Test&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;center&amp;gt;
&amp;lt;img src=&quot;./font.php&amp;lt;?php echo img_params(&#39;Hello World&#39;, 90);?&amp;gt;&quot;&amp;gt;
&amp;lt;/center&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
 
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2015/05/text-rasterization-service-script-using.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-5658860473766036427</guid><pubDate>Thu, 02 Apr 2015 10:11:00 +0000</pubDate><atom:updated>2015-04-02T15:42:45.539+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">htaccess</category><category domain="http://www.blogger.com/atom/ns#">htaccess tips</category><category domain="http://www.blogger.com/atom/ns#">wordpress</category><title>Htaccess code syntax to prevent your wordpress website from attackers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: small; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Htaccess code syntax to prevent your wordpress website from attackers&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6gJUGD3jNivOmCSKkq7rpxaKzO3xY4dvbyhVhgWpFIkMHM512t2yZWijj-xXmXZUrW6vaVS9CdZymgSLFTkSvkZhx0IWm6C6-34gVxGCQ1e6EZ8y-12UIWLcMmfSRTBpXagpBwhEPt9hc/s1600/4everTutorials+-+Htaccess+code+syntax+to+prevent+your+wordpress+website+from+hackers.png&quot; height=&quot;225&quot; title=&quot;Htaccess code syntax to prevent your wordpress website from attackers&quot; width=&quot;400&quot; /&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Hypertext access (.htaccess) file is the common name of a directory-level configuration file which allows decentralised management of web server configuration. A .htaccess file is always added to the root directory, it can override many other configuration settings which includes server’s global configuration, content type and character set.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;A .htaccess file can be used for lots of hacks that will secure and improve functionality for WordPress blogs and websites. Following are lists of main htaccess code snippets which will improve and prevent WordPress sites from hackers. Some will allow to block specific IP addresses to visit the site, redirect visitors to maintenance page when particular site is redesigned or modified, prevent IP addresses to login into the wordpress admin section etc.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Blacklist undesired users and bots ip address&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

&lt;limit get=&quot;&quot; post=&quot;&quot; put=&quot;&quot;&gt;
order allow,deny
allow from all
deny from 132.151.389
deny from 91.131.784
deny from 773.966.769
deny from 178.406.880
&lt;/limit&gt;


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Redirect visitors to a maintenance page&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.php$
RewriteCond %{REMOTE_ADDR} !^123.123.123.123
RewriteRule $ /maintenance.php [R=302,L]


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Redirect www to non www or vice versa&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourblogpath.com [NC]
RewriteRule ^(.*)$ http://yourblogpath.com/$1 [L,R=301]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourblogpath.com [NC]
RewriteRule ^(.*)$ http://www.yourblogpath.com/$1 [L,R=301]


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Force Caching with htaccess&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The following htaccess code won’t help the initial pageload, but it will significantly help subsequent pageloads by sending 304 statuses when requested elements haven’t been modified.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

FileETag MTime Size
ExpiresActive on
ExpiresDefault &quot;access plus x seconds&quot;


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Allow only your IP adress on the wp-admin directory&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Replace your IP with allow from xx.xx.xx.xx which will only allow your IP to access wp-admin directory.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName &quot;Wordpress Admin Access Control&quot;
AuthType Basic
&lt;limit get=&quot;&quot;&gt;
order deny,allow
deny from all
allow from xx.xx.xx.xx
&lt;/limit&gt;


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;The easiest way to ban a WordPress spammer&lt;/b&gt;&lt;br /&gt;
To block certain IP address from accessing your blog enter the following code into .htaccess file and replace example IP address with the one you want to ban.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


## USER IP BANNING
&lt;limit get=&quot;&quot; post=&quot;&quot;&gt;
order allow,deny
deny from 670.45.145.125
allow from all
&lt;/limit&gt;

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Deny access to your wp-config.php file&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

# protect wpconfig.php
&lt;files wp-config.php=&quot;&quot;&gt;
order allow,deny
deny from all
&lt;/files&gt;


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Limit the File upload size to 10MB&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

# limit file uploads to 10mb
LimitRequestBody 10240000


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Password protected directories&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;A simple way to password protect blog directories&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

AuthType Basic
AuthName &quot;restricted area&quot;
AuthUserFile /usr/local/var/www/html/.htpasses
require valid-user


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Quickly secure plugin files&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;WordPress plugin files might have a loop hole and may allow hackers to get into your website. To prevent others to have direct access to plugin files use following code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

&lt;files css=&quot;&quot; js=&quot;&quot;&gt;
  order allow,deny
  allow from all
&lt;/files&gt;


?&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2015/04/htaccess-code-syntax-to-prevent-your-wordpress-website-from-attackers.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6gJUGD3jNivOmCSKkq7rpxaKzO3xY4dvbyhVhgWpFIkMHM512t2yZWijj-xXmXZUrW6vaVS9CdZymgSLFTkSvkZhx0IWm6C6-34gVxGCQ1e6EZ8y-12UIWLcMmfSRTBpXagpBwhEPt9hc/s72-c/4everTutorials+-+Htaccess+code+syntax+to+prevent+your+wordpress+website+from+hackers.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-4530171004404892136</guid><pubDate>Sat, 21 Mar 2015 15:39:00 +0000</pubDate><atom:updated>2015-03-21T21:09:12.043+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">essential php security pdf</category><category domain="http://www.blogger.com/atom/ns#">PHP Security</category><category domain="http://www.blogger.com/atom/ns#">php security best practices</category><category domain="http://www.blogger.com/atom/ns#">php security book</category><category domain="http://www.blogger.com/atom/ns#">php security checklist</category><category domain="http://www.blogger.com/atom/ns#">php security issues</category><category domain="http://www.blogger.com/atom/ns#">php security pdf</category><category domain="http://www.blogger.com/atom/ns#">php security tips</category><category domain="http://www.blogger.com/atom/ns#">php security tutorial</category><title>Popular Security Libraries for PHP Developers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Today, PHP is one of the most popular web programming language for creating dynamic websites. There is bunches of data on the web that PHP developers make utilization of. On the other hand, few of them are obsolete and can manage anybody to compose &quot;awful code. &lt;br /&gt;&lt;br /&gt;In this post, we have introduced to popular PHP security libraries that will help them to create security interfaces for web applications. If you have any suggestion regarding PHP Security Libraries please write in comment box. Thanks&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQK30nj6d0Pr6SLTt-7cWpqkeqo8X2fOoT89IlSlz8VGw9V2QThyphenhyphenJrExsWoN1LnglFW45hkWt2jnSrJ_pBSewPZjWbV1QWiI23B_3vP09gVY9u3E26tdGZyafNY4b8mYSg3yxb5nq5ZyVb/s1600/4everTutorials+-+Popular+Security+Libraries+for+PHP+Developers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Popular Security Libraries for PHP Developers&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQK30nj6d0Pr6SLTt-7cWpqkeqo8X2fOoT89IlSlz8VGw9V2QThyphenhyphenJrExsWoN1LnglFW45hkWt2jnSrJ_pBSewPZjWbV1QWiI23B_3vP09gVY9u3E26tdGZyafNY4b8mYSg3yxb5nq5ZyVb/s1600/4everTutorials+-+Popular+Security+Libraries+for+PHP+Developers.png&quot; height=&quot;276&quot; title=&quot;Popular Security Libraries for PHP Developers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;a href=&quot;http://htmlpurifier.org/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;HTML Purifier&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C’s specifications.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/aarondfrancis/urlcrypt&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;URLcrypt&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;URLcrypt makes it easy to securely transmit short pieces of binary data in a URL. Use it to securely store things like user IDs, download expiration dates, and more. URLcrypt uses 256-bit AES symmetric encryption to securely encrypt data, and encodes and decodes Base 32 strings that can be used directly in URLs.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/PHPIDS/PHPIDS&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;PHP Intrusion Detection System&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application. The IDS neither strips, sanitizes nor filters any malicious input, it simply recognizes when an attacker tries to break your site and reacts in exactly the way you want it to. Based on a set of approved and heavily tested filter rules any attack is given a numerical impact rating which makes it easy to decide what kind of action should follow the hacking attempt. This could range from simple logging to sending out an emergency mail to the development team, displaying a warning message for the attacker or even ending the user’s session.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/timoh6/TCrypto&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;TCrypto&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;TCrypto is a simple and flexible PHP 5.3+ in-memory key-value storage library. By default, a cookie will be used as a storage backend. TCrypto has been designed from the ground up with security in mind. Safe algorithms and modes. Automatic and safe initialization vector creation. Encryption and authentication key creation (Keytool) using strong randomness. Key rotation (versioned keys). TCrypto can be used as a scalable “session handler”. Especially scalable, if cookies are used as a storage backend. This is a bit like Ruby on Rails sessions.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/ircmaxell/PHP-PasswordLib&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;PHP Password Lib&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PHP-PasswordLib aims to be an all-inclusive cryptographic library for all cryptographic needs. It is meant to be easy to install and use, yet extensible and powerful enough for even the most experienced developer.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://phpseclib.sourceforge.net/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;PHPSecLib&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;phpseclib is designed to be ultra-compatible. It works on PHP4+ (PHP4, assuming the use ofPHP_Compat) and doesn’t require any extensions. For purposes of speed, mcrypt is used if it’s available as is gmp or bcmath (in that order), but they are not required.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://hybridauth.sourceforge.net/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Hybrid Auth&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;HybridAuth is an open source PHP library for authenticating through multiple social services and ID providers. The services supported include OpenID,Facebook, LinkedIn, Google,Twitter, Windows Live, Foursquare, Vimeo, Yahoo, PayPal and more. It can be integrated easily into existing websites by inserting a file and few lines to the sign-in/up pages.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://security.sensiolabs.org/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Security Check – Sensiolabs&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This tool is almost essential to both beginners and experienced PHP coders. The way it works is quite simple, you upload your .lockfile and it does the rest for you. If you look at the stats, the numbers of vulnerabilities found is quite staggering, don’t be surprised if your own projects might output some nasty stuff that you have missed.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://github.com/padraic/SecurityMultiTool&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;SecurityMultiTool&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A multitool library offering access to recommended security related libraries, standardised implementations of security defences, and secure implementations of commonly performed tasks. The purpose of the library is to serve as both a useful set of utilities and to act as a set of reference implementations which can be learned from. It may be used by applications regardless of whether they are web application framework based or not. The use of a web application framework does not guarantee your security.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2015/03/popular-security-libraries-for-PHP-Developers.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQK30nj6d0Pr6SLTt-7cWpqkeqo8X2fOoT89IlSlz8VGw9V2QThyphenhyphenJrExsWoN1LnglFW45hkWt2jnSrJ_pBSewPZjWbV1QWiI23B_3vP09gVY9u3E26tdGZyafNY4b8mYSg3yxb5nq5ZyVb/s72-c/4everTutorials+-+Popular+Security+Libraries+for+PHP+Developers.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-3706228530992698753</guid><pubDate>Sat, 21 Mar 2015 15:06:00 +0000</pubDate><atom:updated>2015-03-21T20:36:43.035+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">InnoDB</category><category domain="http://www.blogger.com/atom/ns#">MYISAM</category><category domain="http://www.blogger.com/atom/ns#">mysql</category><title>What is contrast in the middle of MYISAM and InnoDB?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsW5UUQDkmhFQGTcfuw6DiCOBuWyHcfkSenuM4SqNJ_iU6-wr14DZRk9Pxjb1tAAYhXQl4gt6Cg8IHp5sCZ317D9HE_Pgw3LX0e8MPP5P0BY-7CUGi16GDCEVee2lUQV7HpfpJUVr6GHSz/s1600/4everTutorials+-+What+is+contrast+in+the+middle+of+MYISAM+and+InnoDB.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;What is contrast in the middle of MYISAM and InnoDB?&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsW5UUQDkmhFQGTcfuw6DiCOBuWyHcfkSenuM4SqNJ_iU6-wr14DZRk9Pxjb1tAAYhXQl4gt6Cg8IHp5sCZ317D9HE_Pgw3LX0e8MPP5P0BY-7CUGi16GDCEVee2lUQV7HpfpJUVr6GHSz/s1600/4everTutorials+-+What+is+contrast+in+the+middle+of+MYISAM+and+InnoDB.jpg&quot; height=&quot;158&quot; title=&quot;What is contrast in the middle of MYISAM and InnoDB?&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;In this post, I am explaining to each one of PHP developer to understand the difference between MYISAM and INNODB&lt;br /&gt;&lt;br /&gt;&lt;b&gt;MYISAM&lt;/b&gt;&lt;br /&gt;1. MYISAM supports Table-level Locking&lt;br /&gt;2. MyISAM designed for need of speed&lt;br /&gt;3. MyISAM does not support foreign keys hence we call MySQL with MYISAM is DBMS&lt;br /&gt;4. MyISAM stores its tables, data and indexes in diskspace using separate three different files. (tablename.FRM, tablename.MYD, tablename.MYI)&lt;br /&gt;5. MYISAM not supports transaction. You cannot commit and rollback with MYISAM. Once you issue a command it’s done.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;INNODB&lt;/b&gt;&lt;br /&gt;1. InnoDB supports Row-level Locking&lt;br /&gt;2. InnoDB designed for maximum performance when processing high volume of data&lt;br /&gt;3. InnoDB support foreign keys hence we call MySQL with InnoDB is RDBMS&lt;br /&gt;4. InnoDB stores its tables and indexes in a tablespace&lt;br /&gt;5. InnoDB supports transaction. You can commit and rollback with InnoDB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2015/03/what-is-contrast-in-middle-of-myisam-and-innodb.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsW5UUQDkmhFQGTcfuw6DiCOBuWyHcfkSenuM4SqNJ_iU6-wr14DZRk9Pxjb1tAAYhXQl4gt6Cg8IHp5sCZ317D9HE_Pgw3LX0e8MPP5P0BY-7CUGi16GDCEVee2lUQV7HpfpJUVr6GHSz/s72-c/4everTutorials+-+What+is+contrast+in+the+middle+of+MYISAM+and+InnoDB.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-6558121442506044857</guid><pubDate>Fri, 19 Dec 2014 15:27:00 +0000</pubDate><atom:updated>2014-12-26T20:25:05.400+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">parse website</category><title>Parse Website with PHP</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjtAU8v6veUvVORXVLGYjQGl59QEpL8OxXBxBsgMmow5c1DbtCZWwcpuQZBs1Tn4q3S7GF3qOlXndg0rd1YAOZ4jIkh3qhy8mJSJWRgR3OBT6hbXSVpBNofGHC5oo_vRjnCegLjNkA-Mxf/s1600/Parse+Website+with+PHP+4vertutorials.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Parse Website with PHP&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjtAU8v6veUvVORXVLGYjQGl59QEpL8OxXBxBsgMmow5c1DbtCZWwcpuQZBs1Tn4q3S7GF3qOlXndg0rd1YAOZ4jIkh3qhy8mJSJWRgR3OBT6hbXSVpBNofGHC5oo_vRjnCegLjNkA-Mxf/s1600/Parse+Website+with+PHP+4vertutorials.jpg&quot; title=&quot;Parse Website with PHP&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Parsing website pages is always a challenge for PHP Developers. Parsing is using for retrieving images, scraping websites, crawling, error detection websites, and many other useful purposes. But PHP Simple HTML DOM Parser is a awesome or can say dream library for developer that work with both PHP and the DOM element using PHP.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;You can get the Simple HTML DOM Parser from &lt;a href=&quot;http://sourceforge.net/projects/simplehtmldom/files/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; and save file to any directory of your choice. First in a basic example we’ll include the class, and get all hyperlinks on the http://4evertutorials.blogspot.com .&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

// Include the parser library
include(&#39;simple_html_dom.php&#39;);

// Retrieve the DOM from a given URL
$html_dom = file_get_html(&#39;http://4evertutorials.blogspot.com/&#39;);

// scan for all hyperlinks and print
foreach ($html_dom-&amp;gt;find(&#39;a&#39;) as $element) {
       print $element-&amp;gt;href;
}

?&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Below are few basic uses of PHP Simple HTML DOM Parser.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

// Include the parser library
include(&#39;simple_html_dom.php&#39;);

// Retrieve the DOM from a given URL
$html = file_get_html(&#39;http://4evertutorials.blogspot.com/&#39;);

// Find all anchor tags and print their HREFs
foreach($html-&amp;gt;find(&#39;a&#39;) as $e) 
    echo $e-&amp;gt;href;

// Retrieve all images and print their SRCs
foreach($html-&amp;gt;find(&#39;img&#39;) as $e)
    echo $e-&amp;gt;src;

// Find all images, print their text with the &quot;&amp;lt;&amp;gt;&quot; included
foreach($html-&amp;gt;find(&#39;img&#39;) as $e)
    echo $e-&amp;gt;outertext;

// Find all SPAN tags that have a class of &quot;SpanClass&quot;
foreach($html-&amp;gt;find(&#39;span.SpanClass&#39;) as $e)
    echo $e-&amp;gt;outertext;

// Find all TD tags with &quot;align=center&quot;
foreach($html-&amp;gt;find(&#39;td[align=center]&#39;) as $e)
    echo $e-&amp;gt;innertext;

// Extract all text from a given cell
echo $html-&amp;gt;find(&#39;td[align=&quot;center&quot;]&#39;, 1)-&amp;gt;plaintext;

// Find the DIV tag with an id of &quot;DivId&quot;
foreach($html-&amp;gt;find(&#39;div#DivId&#39;) as $e)
    echo $e-&amp;gt;innertext;


?&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2014/12/parse-website-with-php.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjtAU8v6veUvVORXVLGYjQGl59QEpL8OxXBxBsgMmow5c1DbtCZWwcpuQZBs1Tn4q3S7GF3qOlXndg0rd1YAOZ4jIkh3qhy8mJSJWRgR3OBT6hbXSVpBNofGHC5oo_vRjnCegLjNkA-Mxf/s72-c/Parse+Website+with+PHP+4vertutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-1128207047216180084</guid><pubDate>Thu, 16 Oct 2014 06:28:00 +0000</pubDate><atom:updated>2014-10-16T12:02:20.215+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">codeigniter</category><category domain="http://www.blogger.com/atom/ns#">framework</category><title>Install CodeIgniter Framework</title><description>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghVyBOGCa8SjhRY2ZYkDfSTBudxXB7b_VX9vtOHyO9_Lit46ZyCwXZfrrRrBYIcR1pvykAq-rgloin57tt8Zrdet-B5e0fQlXWZMPXWPh4VbXu_a-HIbWJGj0Ehyphenhyphenc6X0hWs1AZB_X1Sjt6/s1600/Install+CodeIgniter+Framework+4everTutorials.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghVyBOGCa8SjhRY2ZYkDfSTBudxXB7b_VX9vtOHyO9_Lit46ZyCwXZfrrRrBYIcR1pvykAq-rgloin57tt8Zrdet-B5e0fQlXWZMPXWPh4VbXu_a-HIbWJGj0Ehyphenhyphenc6X0hWs1AZB_X1Sjt6/s1600/Install+CodeIgniter+Framework+4everTutorials.jpg&quot; height=&quot;171&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;In this post we will cover how to install codeigniter framework and we will view the most common steps to install codeigniter framework. CodeIgniter is one of the most popular&lt;a href=&quot;http://4evertutorials.blogspot.com/p/php-frameworks.html&quot;&gt; PHP frameworks&lt;/a&gt; around. It uses the Model-View-Controller Architectural design pattern and it’s considered by lots of PHP developers as one of the best framework solution for small to medium projects.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;b&gt;How to Install&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The installation itself is such a simple process. First of all, you need to download the CodeIgniter zipped file, upload it to your server and extract it into your home directory. You can download it from https://ellislab.com/codeigniter/user-guide/installation/downloads.html.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuring CodeIgniter&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, now you have CodeIgniter installed on your server. Now it’s time for configuration. Open the application/config/config.php file with your preferred editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. For the database configuration, open the application/config/database.php file with your preferred editor and set your database host, name, user, password and other values that you think it will help you connect to your database. You will find array variables with comments to know the role of each value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuration files&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
By editing the two previously mentioned files, you are ready to start coding your first web application but CodeIgniter contains more files that enable more configuration and customization abilities. The configuration files can be found in the application/config/ directory. The following is a quick description of what you can do by editing some of the most commonly used configuration files:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;autoload.php&lt;/i&gt; : specifies which systems (Packages, Libraries, Helper files, Custom config files, Language files and Models) should be loaded by default.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;config.php&lt;/i&gt; : contains all website configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;constants.php&lt;/i&gt; : contains defined constants which are used when checking and setting modes when working with the file system.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;database.php&lt;/i&gt; : contains the settings needed to access your database.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;email.php &lt;/i&gt;: This file is not created by default. But you can create it and set the default values for the email class. Like: mailtype, charset, newline, protocol, smtp_host, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;hooks.php&lt;/i&gt; : lets you define “hooks” to extend CI without editing the core files.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;mime.php&lt;/i&gt; : contains an array of mime types. It is used by the upload class to help identify allowed file type.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;routes.php&lt;/i&gt; : lets you re-map URI requests to specific controller functions.&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
smileys.php&lt;/i&gt; : contains an array of smileys for use with the emoticon helper.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;upload.php &lt;/i&gt;: This file is not created by default. But you can create it and set the default values for the upload class. Like: upload_path, allowed_types, max_size, max_width, max_height, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;user_agents.php &lt;/i&gt;: contains four arrays of user agent data. It is used by the User Agent Class to help identify browser, platform, robot, and mobile device data. The array keys are used to identify the device and the array values are used to set the actual name of the item.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2014/10/install-codeigniter-framework.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghVyBOGCa8SjhRY2ZYkDfSTBudxXB7b_VX9vtOHyO9_Lit46ZyCwXZfrrRrBYIcR1pvykAq-rgloin57tt8Zrdet-B5e0fQlXWZMPXWPh4VbXu_a-HIbWJGj0Ehyphenhyphenc6X0hWs1AZB_X1Sjt6/s72-c/Install+CodeIgniter+Framework+4everTutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-6369034896264553590</guid><pubDate>Mon, 06 Oct 2014 10:29:00 +0000</pubDate><atom:updated>2014-10-06T16:01:10.466+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">pdf</category><title>php To PDF</title><description>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Lf0WZ-6VjhfMIgvIZ-z-Xl40FRg9oTgp-_7gYAMmg9L4dFa8CDeT4KshDz2YJNC3TAMfmxAO1gtobELrT0Pxw9lXqY9NH7HzOC90dTZAzq40ri9XhhhYL2V6D4Jz7GTdjrpMsVFrfDdS/s1600/php+To+PDF+4evertutorials.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Lf0WZ-6VjhfMIgvIZ-z-Xl40FRg9oTgp-_7gYAMmg9L4dFa8CDeT4KshDz2YJNC3TAMfmxAO1gtobELrT0Pxw9lXqY9NH7HzOC90dTZAzq40ri9XhhhYL2V6D4Jz7GTdjrpMsVFrfDdS/s1600/php+To+PDF+4evertutorials.png&quot; height=&quot;116&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;php To PDF is an API based solution. We are a web service providing you the easiest way to generate PDF files from PHP Code.&lt;br /&gt;
&lt;br /&gt;
Our server does the heavy lifting and generates the PDFs for you. The generated PDF files will be returned and stored on your server in the specified directory with your specified file name, or you can set them to be created and displayed or downloaded by a user on the fly.&lt;br /&gt;
&lt;br /&gt;
You do not need any special packages or permissions. It works on any server running PHP!&lt;br /&gt;
&lt;br /&gt;
We have simplified our API so that you just need to download the phpToPDF.php file from your account and include it in your code.   It&#39;s that simple. &lt;br /&gt;
&lt;br /&gt;
Get started :: PHP to PDF generation steps&lt;br /&gt;
1&amp;nbsp; &lt;a href=&quot;http://phptopdf.com/signup/&quot; target=&quot;_blank&quot;&gt;Sign up&lt;/a&gt; to access our API&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
2&amp;nbsp; FREE!&lt;br /&gt;
3&amp;nbsp; &lt;a href=&quot;http://phptopdf.com/download/&quot; target=&quot;_blank&quot;&gt;Download&lt;/a&gt; and include phpToPDF.php&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sample Code&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Use the phptopdf() function for creating a PDF using a URL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


    require(&#39;phpToPDF.php&#39;);

    //Set Your Options -- see documentation for all options
    $pdf_options = array(
          &quot;source_type&quot; =&gt; &#39;url&#39;,
          &quot;source&quot; =&gt; &#39;http://google.com&#39;,
          &quot;action&quot; =&gt; &#39;save&#39;);

    //Code to generate PDF file from options above
    phptopdf($pdf_options);
 

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Alternatively, you can use the phptopdf() function to pass a varible that holds html code for your PDF. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

    require(&#39;phpToPDF.php&#39;);

    //Your HTML in a variable
    $my_html=&quot;&lt;html&gt;&lt;h2&gt;PDF from HTML using phpToPDF&lt;/h2&gt;&lt;/HTML&gt;&quot;;

    //Set Your Options -- we are saving the PDF as &#39;my_filename.pdf&#39; to a &#39;my_pdfs&#39; folder
    $pdf_options = array(
      &quot;source_type&quot; =&gt; &#39;html&#39;,
      &quot;source&quot; =&gt; $my_html,
      &quot;action&quot; =&gt; &#39;save&#39;,
      &quot;save_directory&quot; =&gt; &#39;my_pdfs&#39;,
      &quot;file_name&quot; =&gt; &#39;my_filename.pdf&#39;);

    //Code to generate PDF file from options above
    phptopdf($pdf_options);


?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
[ &lt;a href=&quot;http://phptopdf.com/examples/&quot; target=&quot;_blank&quot;&gt;More Examples&lt;/a&gt; ]&lt;/span&gt;&lt;/span&gt;</description><link>http://4evertutorials.blogspot.com/2014/10/php-to-pdf.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Lf0WZ-6VjhfMIgvIZ-z-Xl40FRg9oTgp-_7gYAMmg9L4dFa8CDeT4KshDz2YJNC3TAMfmxAO1gtobELrT0Pxw9lXqY9NH7HzOC90dTZAzq40ri9XhhhYL2V6D4Jz7GTdjrpMsVFrfDdS/s72-c/php+To+PDF+4evertutorials.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-8647098847297254344</guid><pubDate>Thu, 04 Sep 2014 16:46:00 +0000</pubDate><atom:updated>2014-09-04T22:23:04.439+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">php 5.6</category><category domain="http://www.blogger.com/atom/ns#">PHP 5.6 Released</category><title>New features in PHP 5.6</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;The PHP development team announced new release of &lt;a href=&quot;http://php.net/releases/5_6_0.php&quot; target=&quot;_blank&quot;&gt;PHP 5.6&lt;/a&gt;. The new release brings new features and lots of improvements, development team say, also as some backward incompatible changes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Following are the most important changes in &lt;a href=&quot;http://php.net/releases/5_6_0.php&quot; target=&quot;_blank&quot;&gt;PHP 5.6 &lt;/a&gt;release:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-gT2sCi8qilLV876ByJR3uCy1rOLsHUj4Zm-6TWOIvm_KbJfmMtpcm45gPL7cHimjen4EwYS37n4oeK18Ei-HzH8gASQiMZkPW2ufz46dlLFq9lvLkuG3glDYH34BQO6TM4A5FjG8YIvq/s1600/logo-php56.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-gT2sCi8qilLV876ByJR3uCy1rOLsHUj4Zm-6TWOIvm_KbJfmMtpcm45gPL7cHimjen4EwYS37n4oeK18Ei-HzH8gASQiMZkPW2ufz46dlLFq9lvLkuG3glDYH34BQO6TM4A5FjG8YIvq/s1600/logo-php56.png&quot; height=&quot;374&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Constant scalar expressions&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;It is now possible to provide a scalar expression involving numeric and string literals and/or constants in contexts where PHP previously expected a static value, such as constant and property declarations and default function arguments.&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

const ONE = 1;
const TWO = ONE * 2;

class C {
    const THREE = TWO + 1;
    const ONE_THIRD = ONE / self::THREE;
    const SENTENCE = &#39;The value of THREE is &#39;.self::THREE;

    public function f($a = ONE + self::THREE) {
        return $a;
    }
}

echo (new C)-&amp;gt;f().&quot;\n&quot;;
echo C::SENTENCE;

//The above example will output:
/*
4
The value of THREE is 3
*/

?&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Improved syntax for variadic functions&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Variadic functions can be declared through a new &lt;b&gt;...&lt;/b&gt; operator:&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/
 
function f($req, $opt = null, ...$params) {
    // $params is an array containing the remaining arguments.
    printf(&#39;$req: %d; $opt: %d; number of params: %d&#39;.&quot;\n&quot;,
           $req, $opt, count($params));
}

f(1);
f(1, 2);
f(1, 2, 3);
f(1, 2, 3, 4);
f(1, 2, 3, 4, 5);

// The above example will output:
/*
$req: 1; $opt: 0; number of params: 0
$req: 1; $opt: 2; number of params: 0
$req: 1; $opt: 2; number of params: 1
$req: 1; $opt: 2; number of params: 2
$req: 1; $opt: 2; number of params: 3
*/

?&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Argument unpacking via ... operator&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;a href=&quot;http://php.net/manual/en/language.types.array.php&quot; target=&quot;_blank&quot;&gt;Arrays &lt;/a&gt;and &lt;a href=&quot;http://php.net/manual/en/class.traversable.php&quot; target=&quot;_blank&quot;&gt;Traversable&lt;/a&gt;&amp;nbsp;objects can be unpacked into argument lists when calling functions by using the ... operator. This is also known as the splat operator in other languages, including Ruby.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

function add($a, $b, $c) {
    return $a + $b + $c;
}

$operators = [2, 3];
echo add(1, ...$operators);

// The above example will output:
/*
6
*/
?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Exponentiation via ** operator&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;A right associative ** operator has been added to support exponentiation, along with a **= shorthand assignment operator.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

printf(&quot;2 ** 3 ==      %d\n&quot;, 2 ** 3);
printf(&quot;2 ** 3 ** 2 == %d\n&quot;, 2 ** 3 ** 2);

$a = 2;
$a **= 3;
printf(&quot;a ==           %d\n&quot;, $a);

// The above example will output:
/*
2 ** 3 ==      8
2 ** 3 ** 2 == 512
a ==           8
*/

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;use function and use const&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;The &lt;a href=&quot;http://php.net/manual/en/language.namespaces.importing.php&quot; target=&quot;_blank&quot;&gt;use&lt;/a&gt;&amp;nbsp;operator has been extended to support importing functions and constants in addition to classes. This is achieved via the use function and use const constructs, respectively.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/ 
 
namespace Name\Space {
    const FOO = 42;
    function f() { echo __FUNCTION__.&quot;\n&quot;; }
}

namespace {
    use const Name\Space\FOO;
    use function Name\Space\f;

    echo FOO.&quot;\n&quot;;
    f();
}

// The above example will output:
/*
42
Name\Space\f
*/


?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Now UTF-8 is Default character encoding&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;a href=&quot;http://php.net/manual/en/ini.core.php#ini.default-charset&quot; target=&quot;_blank&quot;&gt;default_charset&lt;/a&gt; is now used as the default character set for the &lt;a href=&quot;http://php.net/manual/en/function.htmlentities.php&quot; target=&quot;_blank&quot;&gt;htmlentities()&lt;/a&gt;, &lt;a href=&quot;http://php.net/manual/en/function.html-entity-decode.php&quot; target=&quot;_blank&quot;&gt;html_entity_decode()&lt;/a&gt; and &lt;a href=&quot;http://php.net/manual/en/function.htmlspecialchars.php&quot; target=&quot;_blank&quot;&gt;htmlspecialchars()&lt;/a&gt; functions. Note that if the (now deprecated) iconv and mbstring encoding settings are set, they will take precedence over default_charset for iconv and mbstring functions, respectively.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: x-large;&quot;&gt;&lt;b&gt;Large file uploads&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Files larger than 2 gigabytes in size are now accepted.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;GMP supports operator overloading&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;GMP objects now support operator overloading and casting to scalar types. This allows for more expressive code using GMP:&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/ 
 
$a = gmp_init(42);
$b = gmp_init(17);

// Pre-5.6 code:
var_dump(gmp_add($a, $b));
var_dump(gmp_add($a, 17));
var_dump(gmp_add(42, $b));

// New code:
var_dump($a + $b);
var_dump($a + 17);
var_dump(42 + $b);

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Full list of all changes in PHP 5.6 can be additionally found in the &lt;a href=&quot;http://www.php.net/ChangeLog-5.php#5.6.0&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://4evertutorials.blogspot.com/2014/09/new-features-in-php-5-6.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-gT2sCi8qilLV876ByJR3uCy1rOLsHUj4Zm-6TWOIvm_KbJfmMtpcm45gPL7cHimjen4EwYS37n4oeK18Ei-HzH8gASQiMZkPW2ufz46dlLFq9lvLkuG3glDYH34BQO6TM4A5FjG8YIvq/s72-c/logo-php56.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-3243301189738920209</guid><pubDate>Wed, 03 Sep 2014 13:09:00 +0000</pubDate><atom:updated>2014-09-03T18:42:58.345+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">analyze website using google api</category><category domain="http://www.blogger.com/atom/ns#">curl</category><category domain="http://www.blogger.com/atom/ns#">file_get_contents</category><category domain="http://www.blogger.com/atom/ns#">google api</category><category domain="http://www.blogger.com/atom/ns#">pagespeed insight api</category><title>Using Google PageSpeed Insights API with php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;In this post we learn how to analyze websites using google pagespeed insights api with PHP. First of all you need to acquire an API key:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQe7rANt_gaaS6QmMRBko19mFF0kgOIwSMprYTHQDgnpz0K_1iTZ06CUOxEJ63P6jc9c3l93uZ7slQeWNf1-3VzbFyuPb6u4Oe0GInzSDCTmO3ifwFhc4Ec-gCt9Yc3znDNvluaRpOp_tr/s1600/Google-Page-Speed-Service-4evertutorials.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQe7rANt_gaaS6QmMRBko19mFF0kgOIwSMprYTHQDgnpz0K_1iTZ06CUOxEJ63P6jc9c3l93uZ7slQeWNf1-3VzbFyuPb6u4Oe0GInzSDCTmO3ifwFhc4Ec-gCt9Yc3znDNvluaRpOp_tr/s1600/Google-Page-Speed-Service-4evertutorials.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
1) Go to the &lt;a href=&quot;https://console.developers.google.com/&quot; target=&quot;_blank&quot;&gt;Google Developers Console&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
2) Select a project, or create a new one.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
3) In the sidebar on the left, expand &lt;b&gt;APIs &amp;amp; auth&lt;/b&gt;. Next, click &lt;b&gt;APIs&lt;/b&gt;. In the list of APIs, make sure the status is &lt;b&gt;ON &lt;/b&gt;for the PageSpeed Insights API.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
4) In the sidebar on the left, select &lt;b&gt;Credentials&lt;/b&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
5) This API supports two types of credentials. You need only &lt;b&gt;Public API access:&lt;/b&gt; A request that does not provide an &lt;b&gt;OAuth 2.0&lt;/b&gt; token must send an API key. The key identifies your project and provides API access, quota, and reports.&lt;br /&gt;
&lt;br /&gt;
To create an API key, click &lt;b&gt;Create new Key&lt;/b&gt; and select the appropriate key type. Enter the additional information required for that key type and click &lt;b&gt;Create&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Replace &quot;API_KEY&quot; with your ones in following php function.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

function checkPageSpeed($url){  
  if (function_exists(&#39;file_get_contents&#39;)) {  
    $result = @file_get_contents($url);  
  }  
  if ($result == &#39;&#39;) {  
    $ch = curl_init();  
    $timeout = 60;  
    curl_setopt($ch, CURLOPT_URL, $url);  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);  
    $result = curl_exec($ch);  
    curl_close($ch);  
  }  

  return $result;  
}

?&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;HOW TO USE CODE&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$myKEY = &quot;API_KEY&quot;;
$url = &quot;http://4evertutorials.blogspot.com&quot;;
$url_req = &#39;https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=&#39;.$url.&#39;&amp;amp;key=&#39;.$myKEY;
$results = checkPageSpeed($url_req);
echo &#39;&lt;pre&gt;&#39;;
print_r(json_decode($results,true)); 
echo &#39;&lt;/pre&gt;
&#39;;

?&amp;gt;
&lt;/pre&gt;
</description><link>http://4evertutorials.blogspot.com/2014/09/google-pagespeed-insights-api-php.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQe7rANt_gaaS6QmMRBko19mFF0kgOIwSMprYTHQDgnpz0K_1iTZ06CUOxEJ63P6jc9c3l93uZ7slQeWNf1-3VzbFyuPb6u4Oe0GInzSDCTmO3ifwFhc4Ec-gCt9Yc3znDNvluaRpOp_tr/s72-c/Google-Page-Speed-Service-4evertutorials.jpg" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-2728947641599721677</guid><pubDate>Fri, 29 Aug 2014 05:12:00 +0000</pubDate><atom:updated>2014-08-29T11:00:59.465+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">company search in linkedin</category><category domain="http://www.blogger.com/atom/ns#">file_get_contents</category><category domain="http://www.blogger.com/atom/ns#">json_decode</category><category domain="http://www.blogger.com/atom/ns#">linkedin group search</category><category domain="http://www.blogger.com/atom/ns#">linkedin php api company search</category><category domain="http://www.blogger.com/atom/ns#">print_r</category><title>php linkedin company search and group search</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimoYN-fK-8Had-1LrX-2Xb5i3WSNA_ZvhFTG_7_P8MNFc5Jg8QwQJYqajLr2BZ-rXqB_30DjL6FbmjT7AHcZRDnbgevqFJXf6iuKmnbgWR2lOo2aD4JvQa66Ugo8XqxDrLrJgYBw4e8lva/s1600/linkedin-logo-4everTutorials.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimoYN-fK-8Had-1LrX-2Xb5i3WSNA_ZvhFTG_7_P8MNFc5Jg8QwQJYqajLr2BZ-rXqB_30DjL6FbmjT7AHcZRDnbgevqFJXf6iuKmnbgWR2lOo2aD4JvQa66Ugo8XqxDrLrJgYBw4e8lva/s1600/linkedin-logo-4everTutorials.jpeg&quot; height=&quot;265&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Hello programmers, here is simple php code to extract companies and groups details which has linkedin profile. You need only pass search keyword in URL for companies or groups to get their details. It will return a JSON response with id, head line, logo url, displayname, subline, profile url&lt;br /&gt;
&lt;br /&gt;
For example a search of &quot;google&quot; would be &lt;br /&gt;
&lt;b&gt;http://www.linkedin.com/ta/federator?query=google&amp;amp;types=company,group,sitefeature&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Please keep in mind linkedin API does not seem to have this feature. If you need linkedin API, please feel free to read through the &lt;a href=&quot;https://developer.linkedin.com/documents/company-search&quot; target=&quot;_blank&quot;&gt;documentation here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Usage of code&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$companies = file_get_contents(&#39;http://www.linkedin.com/ta/federator?query=google&amp;amp;types=company,group,sitefeature&#39;);

$results = json_decode($companies,true);

echo &quot;&lt;pre&gt;&quot;;
print_r($results);
echo &quot;&lt;/pre&gt;
&quot;;

?&amp;gt;
&lt;/pre&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Output returns&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

Array
(
    [company] =&amp;gt; Array
        (
            [resultList] =&amp;gt; Array
                (
                    [0] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1441
                            [headLine] =&amp;gt; Google
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/062/2ff/080cae8.png
                            [displayName] =&amp;gt; Google
                            [subLine] =&amp;gt; Internet; 10,001+ employees
                            [url] =&amp;gt; http://www.linkedin.com/company/1441
                        )

                    [1] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2486941
                            [headLine] =&amp;gt; Google SEO (Page 1 Google)
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/4/000/139/37d/3d91dea.png
                            [displayName] =&amp;gt; Google SEO (Page 1 Google)
                            [subLine] =&amp;gt; Internet; 1-10 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/2486941
                        )

                    [2] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3017073
                            [headLine] =&amp;gt; Google / Titan Aerospace
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/6/000/220/1c0/16d865f.png
                            [displayName] =&amp;gt; Google / Titan Aerospace
                            [subLine] =&amp;gt; Airlines/Aviation; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/3017073
                        )

                    [3] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 621453
                            [headLine] =&amp;gt; Wildfire by Google
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/2/000/18f/281/144bd3b.png
                            [displayName] =&amp;gt; Wildfire by Google
                            [subLine] =&amp;gt; Computer Software; 201-500 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/621453
                        )

                    [4] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1176352
                            [headLine] =&amp;gt; Geoambiente - Google Enterprise Partner
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/8/005/056/2ff/10d57ab.png
                            [displayName] =&amp;gt; Geoambiente - Google Enterprise Partner
                            [subLine] =&amp;gt; Information Technology and Services; 51-200 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/1176352
                        )

                    [5] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 791962
                            [headLine] =&amp;gt; Adometry by Google
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/18e/2ac/0e9319c.png
                            [displayName] =&amp;gt; Adometry by Google
                            [subLine] =&amp;gt; Marketing and Advertising; 51-200 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/791962
                        )

                    [6] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 9863
                            [headLine] =&amp;gt; ITA Software by Google
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/0ae/217/0b991b7.png
                            [displayName] =&amp;gt; ITA Software by Google
                            [subLine] =&amp;gt; Computer Software; 10,001+ employees
                            [url] =&amp;gt; http://www.linkedin.com/company/9863
                        )

                    [7] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2871869
                            [headLine] =&amp;gt; Google Account Managers
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/7/000/1e3/199/293d5b2.png
                            [displayName] =&amp;gt; Google Account Managers
                            [subLine] =&amp;gt; Marketing and Advertising; 1-10 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/2871869
                        )

                    [8] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2321528
                            [headLine] =&amp;gt; Google AdWords Certified
                            [displayName] =&amp;gt; Google AdWords Certified
                            [subLine] =&amp;gt; Marketing and Advertising; Myself Only
                            [url] =&amp;gt; http://www.linkedin.com/company/2321528
                        )

                    [9] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2287804
                            [headLine] =&amp;gt; Googlelearn
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/0da/002/023b4ef.png
                            [displayName] =&amp;gt; Googlelearn
                            [subLine] =&amp;gt; Education Management; Myself Only
                            [url] =&amp;gt; http://www.linkedin.com/company/2287804
                        )

                    [10] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3215165
                            [headLine] =&amp;gt; Squared Online - a Google / HLC Partnership
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/6/005/056/2d9/33a677d.png
                            [displayName] =&amp;gt; Squared Online - a Google / HLC Partnership
                            [subLine] =&amp;gt; E-Learning; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/3215165
                        )

                    [11] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2336657
                            [headLine] =&amp;gt; Google Apps Authorized Reseller | Bmeet.it
                            [displayName] =&amp;gt; Google Apps Authorized Reseller | Bmeet.it
                            [subLine] =&amp;gt; Information Technology and Services; Myself Only
                            [url] =&amp;gt; http://www.linkedin.com/company/2336657
                        )

                    [12] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 762501
                            [headLine] =&amp;gt; Bump Technologies (acquired by Google)
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/4/000/14c/1a4/3079095.png
                            [displayName] =&amp;gt; Bump Technologies (acquired by Google)
                            [subLine] =&amp;gt; Wireless; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/762501
                        )

                    [13] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2093403
                            [headLine] =&amp;gt; Video Marketing, VSEO, Google Places Optimization, Page One of Google at Cary Duke
                            [displayName] =&amp;gt; Video Marketing, VSEO, Google Places Optimization, Page One of Google at Cary Duke
                            [subLine] =&amp;gt; Marketing and Advertising; Myself Only
                            [url] =&amp;gt; http://www.linkedin.com/company/2093403
                        )

                    [14] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2372226
                            [headLine] =&amp;gt; Focus BC - EMEA Google Enterprise Partner
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/005/03d/3d5/1f046f8.png
                            [displayName] =&amp;gt; Focus BC - EMEA Google Enterprise Partner
                            [subLine] =&amp;gt; Management Consulting; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/2372226
                        )

                    [15] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3489855
                            [headLine] =&amp;gt; PANOSUR - Google Maps Business Views certified Photographer
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/005/081/09e/08920d6.png
                            [displayName] =&amp;gt; PANOSUR - Google Maps Business Views certified Photographer
                            [subLine] =&amp;gt; Photography; 1-10 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/3489855
                        )

                    [16] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3361424
                            [headLine] =&amp;gt; Arroba System - Google Apps Authorized Reseller
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/7/005/019/37e/1933930.png
                            [displayName] =&amp;gt; Arroba System - Google Apps Authorized Reseller
                            [subLine] =&amp;gt; Internet; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/3361424
                        )

                    [17] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 978865
                            [headLine] =&amp;gt; WIMM Labs (acquired by Google)
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/071/203/0b3d11a.png
                            [displayName] =&amp;gt; WIMM Labs (acquired by Google)
                            [subLine] =&amp;gt; Consumer Electronics; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/978865
                        )

                    [18] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3081545
                            [headLine] =&amp;gt; Google Virksomhedsbilleder: Google går indenfor i din virksomhed
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/2/000/241/1af/2f5a4b8.png
                            [displayName] =&amp;gt; Google Virksomhedsbilleder: Google gÃ¥r indenfor i din virksomhed
                            [subLine] =&amp;gt; Photography; Myself Only
                            [url] =&amp;gt; http://www.linkedin.com/company/3081545
                        )

                    [19] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3200505
                            [headLine] =&amp;gt; Google International
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/5/005/042/1fa/3d1c00e.png
                            [displayName] =&amp;gt; Google International
                            [subLine] =&amp;gt; Legal Services; 11-50 employees
                            [url] =&amp;gt; http://www.linkedin.com/company/3200505
                        )

                )

        )

    [group] =&amp;gt; Array
        (
            [resultList] =&amp;gt; Array
                (
                    [0] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 4248784
                            [headLine] =&amp;gt; Google
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/128/301/196fb6a.png
                            [displayName] =&amp;gt; Google
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=4248784&amp;amp;mostPopular=
                        )

                    [1] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 4006283
                            [headLine] =&amp;gt; GOOGLE+
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/0d7/077/064bc0b.png
                            [displayName] =&amp;gt; GOOGLE+
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=4006283&amp;amp;mostPopular=
                        )

                    [2] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 76373
                            [headLine] =&amp;gt; Google Android
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/01f/3e7/2fd0a55.png
                            [displayName] =&amp;gt; Google Android
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=76373&amp;amp;mostPopular=
                        )

                    [3] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2930475
                            [headLine] =&amp;gt; Google Universe : Jobs, Tools, Trends and Galaxies of Ideas
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/2/000/057/1c8/2bc17fb.png
                            [displayName] =&amp;gt; Google Universe : Jobs, Tools, Trends and Galaxies of Ideas
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=2930475&amp;amp;mostPopular=
                        )

                    [4] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1604367
                            [headLine] =&amp;gt; Google Analytics
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/01f/0e8/326ef60.png
                            [displayName] =&amp;gt; Google Analytics
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=1604367&amp;amp;mostPopular=
                        )

                    [5] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 37724
                            [headLine] =&amp;gt; Google Adwords Qualified Individuals
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/000/2fa/137b4fa.png
                            [displayName] =&amp;gt; Google Adwords Qualified Individuals
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=37724&amp;amp;mostPopular=
                        )

                    [6] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 85376
                            [headLine] =&amp;gt; Google Apps
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/2/000/007/2c8/1b2d372.png
                            [displayName] =&amp;gt; Google Apps
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=85376&amp;amp;mostPopular=
                        )

                    [7] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1825251
                            [headLine] =&amp;gt; Google Professional Network
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/005/020/06c/2dedc76.png
                            [displayName] =&amp;gt; Google Professional Network
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=1825251&amp;amp;mostPopular=
                        )

                    [8] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 107462
                            [headLine] =&amp;gt; Google APPS users
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/0a8/310/195dc10.png
                            [displayName] =&amp;gt; Google APPS users
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=107462&amp;amp;mostPopular=
                        )

                    [9] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3190679
                            [headLine] =&amp;gt; Google Adwords SEO SEM (Search Engine Optimization &amp;amp; Internet Marketing)
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/063/225/3d1ab3b.png
                            [displayName] =&amp;gt; Google Adwords SEO SEM (Search Engine Optimization &amp;amp; Internet Marketing)
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=3190679&amp;amp;mostPopular=
                        )

                    [10] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 3066064
                            [headLine] =&amp;gt; Google Android TV
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/4/000/132/34b/148cc74.png
                            [displayName] =&amp;gt; Google Android TV
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=3066064&amp;amp;mostPopular=
                        )

                    [11] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 95911
                            [headLine] =&amp;gt; Google Adwords
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/008/327/0b214eb.png
                            [displayName] =&amp;gt; Google Adwords
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=95911&amp;amp;mostPopular=
                        )

                    [12] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 36431
                            [headLine] =&amp;gt; Google Alumni
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/00c/33f/0724411.png
                            [displayName] =&amp;gt; Google Alumni
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=36431&amp;amp;mostPopular=
                        )

                    [13] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 128878
                            [headLine] =&amp;gt; Google App Engine Developers
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/00b/325/2709731.png
                            [displayName] =&amp;gt; Google App Engine Developers
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=128878&amp;amp;mostPopular=
                        )

                    [14] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1840064
                            [headLine] =&amp;gt; Google Analytics Qualified Individuals
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/2/000/01e/38e/1919a0b.png
                            [displayName] =&amp;gt; Google Analytics Qualified Individuals
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=1840064&amp;amp;mostPopular=
                        )

                    [15] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 4022728
                            [headLine] =&amp;gt; Google Plus Marketing
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/0e5/2dc/34faf4e.png
                            [displayName] =&amp;gt; Google Plus Marketing
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=4022728&amp;amp;mostPopular=
                        )

                    [16] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1873841
                            [headLine] =&amp;gt; Google Apps Solution Providers
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/3/000/020/345/2803f2e.png
                            [displayName] =&amp;gt; Google Apps Solution Providers
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=1873841&amp;amp;mostPopular=
                        )

                    [17] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 2768916
                            [headLine] =&amp;gt; Google+ and Google Products for Nonprofit Organizations
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/1/000/080/2fd/0d176f3.png
                            [displayName] =&amp;gt; Google+ and Google Products for Nonprofit Organizations
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=2768916&amp;amp;mostPopular=
                        )

                    [18] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 93548
                            [headLine] =&amp;gt; Google Adwords Professional Group
                            [displayName] =&amp;gt; Google Adwords Professional Group
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=93548&amp;amp;mostPopular=
                        )

                    [19] =&amp;gt; Array
                        (
                            [id] =&amp;gt; 1772976
                            [headLine] =&amp;gt; Google SEO en Zoekmachine Professionals Nederland
                            [imageUrl] =&amp;gt; http://m.c.lnkd.licdn.com/mpr/mpr/shrink_40_40/p/4/005/03b/12f/3d921f3.png
                            [displayName] =&amp;gt; Google SEO en Zoekmachine Professionals Nederland
                            [subLine] =&amp;gt; 
                            [url] =&amp;gt; http://www.linkedin.com/groups?gid=1772976&amp;amp;mostPopular=
                        )

                )

        )

)


?&amp;gt;
&lt;/pre&gt;
</description><link>http://4evertutorials.blogspot.com/2014/08/php-linkedin-company-search-and-group-search.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimoYN-fK-8Had-1LrX-2Xb5i3WSNA_ZvhFTG_7_P8MNFc5Jg8QwQJYqajLr2BZ-rXqB_30DjL6FbmjT7AHcZRDnbgevqFJXf6iuKmnbgWR2lOo2aD4JvQa66Ugo8XqxDrLrJgYBw4e8lva/s72-c/linkedin-logo-4everTutorials.jpeg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-9182509755275596034</guid><pubDate>Sat, 23 Aug 2014 11:25:00 +0000</pubDate><atom:updated>2014-08-23T16:55:24.545+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">api Integration</category><category domain="http://www.blogger.com/atom/ns#">php</category><category domain="http://www.blogger.com/atom/ns#">screen capture website php</category><category domain="http://www.blogger.com/atom/ns#">take webpage screenshot</category><title>php capture website screenshot script</title><description>&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;In this post we learn how to take websites screenshots very easily in PHP using Grabz.it &#39;s API. First of all you need to create grabz.it account&amp;nbsp; to get API keys (APPLICATION KEY and APPLICATION SECRET) . Replace &quot;APPLICATION KEY&quot;, &quot;APPLICATION SECRET&quot; with the values from your account. The best way to put website screenshots into your PHP application is by using our&lt;a href=&quot;http://grabz.it/api/php/download.aspx&quot; target=&quot;_blank&quot;&gt; simple PHP API&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php

/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/
include(&quot;GrabzItClient.class.php&quot;);

$grabzIt = new GrabzItClient(&quot;APPLICATION KEY&quot;, &quot;APPLICATION SECRET&quot;);// Replace &quot;APPLICATION KEY&quot;, &quot;APPLICATION SECRET&quot; with the values from your account!

// To take a image screenshot
$grabzIt-&gt;SetImageOptions(&quot;http://www.google.com&quot;);     
// Or to take a PDF screenshot
$grabzIt-&gt;SetPDFOptions(&quot;http://www.google.com&quot;);
// Or to capture table(s)
$grabzIt-&gt;SetTableOptions(&quot;http://www.google.com&quot;);

?&amp;gt;
&lt;/pre&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Above code is used to create class object with your account API key and secret after creating object we are calling 3 different methods SetImageOptions used to capture image of given page output, SetPDFOptions used to create PDF of given url and SetTableOptions is used to extract tables from the web page.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;More Options&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are many more options including; configuring the browser height, browser width, screenshot height, screenshot width, the delay before a screenshot is taken and the image format of the screenshot. For all these options please see the &lt;a href=&quot;http://grabz.it/api/php/grabzitclient.aspx&quot; target=&quot;_blank&quot;&gt;Client documentation&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixpkKlkx3YOOB1xeWQKNUKWqwNYmOlNG4aNuZG1qL7mYcTItDWAGq9vPemOpNV0oNnSbxoD89vQ86-HByaX2IervigfvydbdSoAnliwOC1NG_OUdPxEp6R-g1HBpAZwxNt-vXvbofeHiuq/s1600/4evertutorials.blogspot.com-Image-Edition-Tools-Screenshoticon.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixpkKlkx3YOOB1xeWQKNUKWqwNYmOlNG4aNuZG1qL7mYcTItDWAGq9vPemOpNV0oNnSbxoD89vQ86-HByaX2IervigfvydbdSoAnliwOC1NG_OUdPxEp6R-g1HBpAZwxNt-vXvbofeHiuq/s1600/4evertutorials.blogspot.com-Image-Edition-Tools-Screenshoticon.png&quot; height=&quot;320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;</description><link>http://4evertutorials.blogspot.com/2014/08/php-capture-website-screenshot-script.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixpkKlkx3YOOB1xeWQKNUKWqwNYmOlNG4aNuZG1qL7mYcTItDWAGq9vPemOpNV0oNnSbxoD89vQ86-HByaX2IervigfvydbdSoAnliwOC1NG_OUdPxEp6R-g1HBpAZwxNt-vXvbofeHiuq/s72-c/4evertutorials.blogspot.com-Image-Edition-Tools-Screenshoticon.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-1112409560112331968</guid><pubDate>Wed, 20 Aug 2014 07:41:00 +0000</pubDate><atom:updated>2014-08-22T12:01:09.448+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">create data uri</category><category domain="http://www.blogger.com/atom/ns#">data uri</category><category domain="http://www.blogger.com/atom/ns#">image data uri</category><category domain="http://www.blogger.com/atom/ns#">php get data uri</category><title>php image data uri</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;To create data uri in php, read image (png, gif, jpg) file with file_get_contents and convert it to base64 using base64_encode. Using Data URIs you can reduce network requests. But, Please keep in mind if you plan on using data URIs, they are not supported by ie7 and lower.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTpDSD20CLyoHQLehVochTbKDvLmrFLXJFbUMqhObnosofN2sfWXRY-nZLeyc7L2BBqoXVS75vqID1b2X_d64YEthB4M5f9mv5D3SFJV6J-OuBEskqAT8VlWgpyrBXKVlLOuP2vFSAvnpD/s1600/4everTutorials.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTpDSD20CLyoHQLehVochTbKDvLmrFLXJFbUMqhObnosofN2sfWXRY-nZLeyc7L2BBqoXVS75vqID1b2X_d64YEthB4M5f9mv5D3SFJV6J-OuBEskqAT8VlWgpyrBXKVlLOuP2vFSAvnpD/s1600/4everTutorials.jpg&quot; height=&quot;232&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


function createDataURI($image,$mime=&#39;&#39;) {

    $finfo = new finfo(FILEINFO_MIME_TYPE);

    $mime = $finfo-&amp;gt;buffer(file_get_contents($image));

    return &#39;data:&#39;.$mime.&#39;;base64,&#39;.base64_encode(file_get_contents($image));
}

?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
How to&amp;nbsp; create data uri&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre class=&quot;php:firstline[10]&quot; name=&quot;code&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


echo &#39;&lt;img src=&quot;&#39;.createDataURI(&#39;path_to/your_image.png&#39;).&#39;&quot; /&gt;&#39;;

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
</description><link>http://4evertutorials.blogspot.com/2014/08/php-image-data-uri.html</link><author>noreply@blogger.com (Web master)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTpDSD20CLyoHQLehVochTbKDvLmrFLXJFbUMqhObnosofN2sfWXRY-nZLeyc7L2BBqoXVS75vqID1b2X_d64YEthB4M5f9mv5D3SFJV6J-OuBEskqAT8VlWgpyrBXKVlLOuP2vFSAvnpD/s72-c/4everTutorials.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-8536806473011601880</guid><pubDate>Wed, 20 Aug 2014 07:14:00 +0000</pubDate><atom:updated>2014-08-20T12:47:16.854+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">decrypt in php</category><category domain="http://www.blogger.com/atom/ns#">encrypt decrypt php</category><category domain="http://www.blogger.com/atom/ns#">encrypt in php</category><category domain="http://www.blogger.com/atom/ns#">php decrypt</category><category domain="http://www.blogger.com/atom/ns#">php encrypt</category><title>best method to encrypt or decrypt in php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: large;&quot;&gt;Here is a safe encrypt and decrypt function for php developer. You can Encrypt and Decrypt using md5. The md5() function calculates the MD5 hash of a string. md5() and sha1() provides the same functinality of encryption in php but they differ in a simple way that md5() generates 32 characters of encrypted string which sha1() generates same of 40 characters.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


function encrypt_decrypt($action, $string) {
   $output = false;

   $key = &#39;My strong random secret key&#39;;

   // initialization vector 
   $iv = md5(md5($key));

   if( $action == &#39;encrypt&#39; ) {
       $output = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, $iv);
       $output = base64_encode($output);
   }
   else if( $action == &#39;decrypt&#39; ){
       $output = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, $iv);
       $output = rtrim($output, &quot;&quot;);
   }
   return $output;
}

?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif; font-size: large;&quot;&gt;How to use encrypt or decrypt code:&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


$plain_txt = &quot;This is my plain text&quot;;
$encrypted_txt = encrypt_decrypt(&#39;encrypt&#39;, $plain_txt);
echo &quot;Encrypted = $encrypted_txt\n&quot;;
echo &quot;&lt;br /&gt;&quot;;
$decrypted_txt = encrypt_decrypt(&#39;decrypt&#39;, $encrypted_txt);
echo &quot;Decrypted = $decrypted_txt\n&quot;;

?&amp;gt;
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2014/08/best-method-to-encrypt-or-decrypt-in-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-3430117141560777254</guid><pubDate>Mon, 11 Aug 2014 17:01:00 +0000</pubDate><atom:updated>2014-08-11T22:31:48.592+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">alpha-2 code</category><category domain="http://www.blogger.com/atom/ns#">country code</category><title>get country from alpha-2 code in php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest. In this post we use php to get country name from alpha-2 code of country.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/



function getCountryName($code)
{
    $country = &#39;&#39;;
    if( $code == &#39;AF&#39; ) $country = &#39;Afghanistan&#39;;
    if( $code == &#39;AX&#39; ) $country = &#39;Aland Islands&#39;;
    if( $code == &#39;AL&#39; ) $country = &#39;Albania&#39;;
    if( $code == &#39;DZ&#39; ) $country = &#39;Algeria&#39;;
    if( $code == &#39;AS&#39; ) $country = &#39;American Samoa&#39;;
    if( $code == &#39;AD&#39; ) $country = &#39;Andorra&#39;;
    if( $code == &#39;AO&#39; ) $country = &#39;Angola&#39;;
    if( $code == &#39;AI&#39; ) $country = &#39;Anguilla&#39;;
    if( $code == &#39;AQ&#39; ) $country = &#39;Antarctica&#39;;
    if( $code == &#39;AG&#39; ) $country = &#39;Antigua and Barbuda&#39;;
    if( $code == &#39;AR&#39; ) $country = &#39;Argentina&#39;;
    if( $code == &#39;AM&#39; ) $country = &#39;Armenia&#39;;
    if( $code == &#39;AW&#39; ) $country = &#39;Aruba&#39;;
    if( $code == &#39;AU&#39; ) $country = &#39;Australia&#39;;
    if( $code == &#39;AT&#39; ) $country = &#39;Austria&#39;;
    if( $code == &#39;AZ&#39; ) $country = &#39;Azerbaijan&#39;;
    if( $code == &#39;BS&#39; ) $country = &#39;Bahamas the&#39;;
    if( $code == &#39;BH&#39; ) $country = &#39;Bahrain&#39;;
    if( $code == &#39;BD&#39; ) $country = &#39;Bangladesh&#39;;
    if( $code == &#39;BB&#39; ) $country = &#39;Barbados&#39;;
    if( $code == &#39;BY&#39; ) $country = &#39;Belarus&#39;;
    if( $code == &#39;BE&#39; ) $country = &#39;Belgium&#39;;
    if( $code == &#39;BZ&#39; ) $country = &#39;Belize&#39;;
    if( $code == &#39;BJ&#39; ) $country = &#39;Benin&#39;;
    if( $code == &#39;BM&#39; ) $country = &#39;Bermuda&#39;;
    if( $code == &#39;BT&#39; ) $country = &#39;Bhutan&#39;;
    if( $code == &#39;BO&#39; ) $country = &#39;Bolivia&#39;;
    if( $code == &#39;BA&#39; ) $country = &#39;Bosnia and Herzegovina&#39;;
    if( $code == &#39;BW&#39; ) $country = &#39;Botswana&#39;;
    if( $code == &#39;BV&#39; ) $country = &#39;Bouvet Island (Bouvetoya)&#39;;
    if( $code == &#39;BR&#39; ) $country = &#39;Brazil&#39;;
    if( $code == &#39;IO&#39; ) $country = &#39;British Indian Ocean Territory (Chagos Archipelago)&#39;;
    if( $code == &#39;VG&#39; ) $country = &#39;British Virgin Islands&#39;;
    if( $code == &#39;BN&#39; ) $country = &#39;Brunei Darussalam&#39;;
    if( $code == &#39;BG&#39; ) $country = &#39;Bulgaria&#39;;
    if( $code == &#39;BF&#39; ) $country = &#39;Burkina Faso&#39;;
    if( $code == &#39;BI&#39; ) $country = &#39;Burundi&#39;;
    if( $code == &#39;KH&#39; ) $country = &#39;Cambodia&#39;;
    if( $code == &#39;CM&#39; ) $country = &#39;Cameroon&#39;;
    if( $code == &#39;CA&#39; ) $country = &#39;Canada&#39;;
    if( $code == &#39;CV&#39; ) $country = &#39;Cape Verde&#39;;
    if( $code == &#39;KY&#39; ) $country = &#39;Cayman Islands&#39;;
    if( $code == &#39;CF&#39; ) $country = &#39;Central African Republic&#39;;
    if( $code == &#39;TD&#39; ) $country = &#39;Chad&#39;;
    if( $code == &#39;CL&#39; ) $country = &#39;Chile&#39;;
    if( $code == &#39;CN&#39; ) $country = &#39;China&#39;;
    if( $code == &#39;CX&#39; ) $country = &#39;Christmas Island&#39;;
    if( $code == &#39;CC&#39; ) $country = &#39;Cocos (Keeling) Islands&#39;;
    if( $code == &#39;CO&#39; ) $country = &#39;Colombia&#39;;
    if( $code == &#39;KM&#39; ) $country = &#39;Comoros the&#39;;
    if( $code == &#39;CD&#39; ) $country = &#39;Congo&#39;;
    if( $code == &#39;CG&#39; ) $country = &#39;Congo the&#39;;
    if( $code == &#39;CK&#39; ) $country = &#39;Cook Islands&#39;;
    if( $code == &#39;CR&#39; ) $country = &#39;Costa Rica&#39;;
    if( $code == &#39;CI&#39; ) $country = &#39;Cote d\&#39;Ivoire&#39;;
    if( $code == &#39;HR&#39; ) $country = &#39;Croatia&#39;;
    if( $code == &#39;CU&#39; ) $country = &#39;Cuba&#39;;
    if( $code == &#39;CY&#39; ) $country = &#39;Cyprus&#39;;
    if( $code == &#39;CZ&#39; ) $country = &#39;Czech Republic&#39;;
    if( $code == &#39;DK&#39; ) $country = &#39;Denmark&#39;;
    if( $code == &#39;DJ&#39; ) $country = &#39;Djibouti&#39;;
    if( $code == &#39;DM&#39; ) $country = &#39;Dominica&#39;;
    if( $code == &#39;DO&#39; ) $country = &#39;Dominican Republic&#39;;
    if( $code == &#39;EC&#39; ) $country = &#39;Ecuador&#39;;
    if( $code == &#39;EG&#39; ) $country = &#39;Egypt&#39;;
    if( $code == &#39;SV&#39; ) $country = &#39;El Salvador&#39;;
    if( $code == &#39;GQ&#39; ) $country = &#39;Equatorial Guinea&#39;;
    if( $code == &#39;ER&#39; ) $country = &#39;Eritrea&#39;;
    if( $code == &#39;EE&#39; ) $country = &#39;Estonia&#39;;
    if( $code == &#39;ET&#39; ) $country = &#39;Ethiopia&#39;;
    if( $code == &#39;FO&#39; ) $country = &#39;Faroe Islands&#39;;
    if( $code == &#39;FK&#39; ) $country = &#39;Falkland Islands (Malvinas)&#39;;
    if( $code == &#39;FJ&#39; ) $country = &#39;Fiji the Fiji Islands&#39;;
    if( $code == &#39;FI&#39; ) $country = &#39;Finland&#39;;
    if( $code == &#39;FR&#39; ) $country = &#39;France, French Republic&#39;;
    if( $code == &#39;GF&#39; ) $country = &#39;French Guiana&#39;;
    if( $code == &#39;PF&#39; ) $country = &#39;French Polynesia&#39;;
    if( $code == &#39;TF&#39; ) $country = &#39;French Southern Territories&#39;;
    if( $code == &#39;GA&#39; ) $country = &#39;Gabon&#39;;
    if( $code == &#39;GM&#39; ) $country = &#39;Gambia the&#39;;
    if( $code == &#39;GE&#39; ) $country = &#39;Georgia&#39;;
    if( $code == &#39;DE&#39; ) $country = &#39;Germany&#39;;
    if( $code == &#39;GH&#39; ) $country = &#39;Ghana&#39;;
    if( $code == &#39;GI&#39; ) $country = &#39;Gibraltar&#39;;
    if( $code == &#39;GR&#39; ) $country = &#39;Greece&#39;;
    if( $code == &#39;GL&#39; ) $country = &#39;Greenland&#39;;
    if( $code == &#39;GD&#39; ) $country = &#39;Grenada&#39;;
    if( $code == &#39;GP&#39; ) $country = &#39;Guadeloupe&#39;;
    if( $code == &#39;GU&#39; ) $country = &#39;Guam&#39;;
    if( $code == &#39;GT&#39; ) $country = &#39;Guatemala&#39;;
    if( $code == &#39;GG&#39; ) $country = &#39;Guernsey&#39;;
    if( $code == &#39;GN&#39; ) $country = &#39;Guinea&#39;;
    if( $code == &#39;GW&#39; ) $country = &#39;Guinea-Bissau&#39;;
    if( $code == &#39;GY&#39; ) $country = &#39;Guyana&#39;;
    if( $code == &#39;HT&#39; ) $country = &#39;Haiti&#39;;
    if( $code == &#39;HM&#39; ) $country = &#39;Heard Island and McDonald Islands&#39;;
    if( $code == &#39;VA&#39; ) $country = &#39;Holy See (Vatican City State)&#39;;
    if( $code == &#39;HN&#39; ) $country = &#39;Honduras&#39;;
    if( $code == &#39;HK&#39; ) $country = &#39;Hong Kong&#39;;
    if( $code == &#39;HU&#39; ) $country = &#39;Hungary&#39;;
    if( $code == &#39;IS&#39; ) $country = &#39;Iceland&#39;;
    if( $code == &#39;IN&#39; ) $country = &#39;India&#39;;
    if( $code == &#39;ID&#39; ) $country = &#39;Indonesia&#39;;
    if( $code == &#39;IR&#39; ) $country = &#39;Iran&#39;;
    if( $code == &#39;IQ&#39; ) $country = &#39;Iraq&#39;;
    if( $code == &#39;IE&#39; ) $country = &#39;Ireland&#39;;
    if( $code == &#39;IM&#39; ) $country = &#39;Isle of Man&#39;;
    if( $code == &#39;IL&#39; ) $country = &#39;Israel&#39;;
    if( $code == &#39;IT&#39; ) $country = &#39;Italy&#39;;
    if( $code == &#39;JM&#39; ) $country = &#39;Jamaica&#39;;
    if( $code == &#39;JP&#39; ) $country = &#39;Japan&#39;;
    if( $code == &#39;JE&#39; ) $country = &#39;Jersey&#39;;
    if( $code == &#39;JO&#39; ) $country = &#39;Jordan&#39;;
    if( $code == &#39;KZ&#39; ) $country = &#39;Kazakhstan&#39;;
    if( $code == &#39;KE&#39; ) $country = &#39;Kenya&#39;;
    if( $code == &#39;KI&#39; ) $country = &#39;Kiribati&#39;;
    if( $code == &#39;KP&#39; ) $country = &#39;Korea&#39;;
    if( $code == &#39;KR&#39; ) $country = &#39;Korea&#39;;
    if( $code == &#39;KW&#39; ) $country = &#39;Kuwait&#39;;
    if( $code == &#39;KG&#39; ) $country = &#39;Kyrgyz Republic&#39;;
    if( $code == &#39;LA&#39; ) $country = &#39;Lao&#39;;
    if( $code == &#39;LV&#39; ) $country = &#39;Latvia&#39;;
    if( $code == &#39;LB&#39; ) $country = &#39;Lebanon&#39;;
    if( $code == &#39;LS&#39; ) $country = &#39;Lesotho&#39;;
    if( $code == &#39;LR&#39; ) $country = &#39;Liberia&#39;;
    if( $code == &#39;LY&#39; ) $country = &#39;Libyan Arab Jamahiriya&#39;;
    if( $code == &#39;LI&#39; ) $country = &#39;Liechtenstein&#39;;
    if( $code == &#39;LT&#39; ) $country = &#39;Lithuania&#39;;
    if( $code == &#39;LU&#39; ) $country = &#39;Luxembourg&#39;;
    if( $code == &#39;MO&#39; ) $country = &#39;Macao&#39;;
    if( $code == &#39;MK&#39; ) $country = &#39;Macedonia&#39;;
    if( $code == &#39;MG&#39; ) $country = &#39;Madagascar&#39;;
    if( $code == &#39;MW&#39; ) $country = &#39;Malawi&#39;;
    if( $code == &#39;MY&#39; ) $country = &#39;Malaysia&#39;;
    if( $code == &#39;MV&#39; ) $country = &#39;Maldives&#39;;
    if( $code == &#39;ML&#39; ) $country = &#39;Mali&#39;;
    if( $code == &#39;MT&#39; ) $country = &#39;Malta&#39;;
    if( $code == &#39;MH&#39; ) $country = &#39;Marshall Islands&#39;;
    if( $code == &#39;MQ&#39; ) $country = &#39;Martinique&#39;;
    if( $code == &#39;MR&#39; ) $country = &#39;Mauritania&#39;;
    if( $code == &#39;MU&#39; ) $country = &#39;Mauritius&#39;;
    if( $code == &#39;YT&#39; ) $country = &#39;Mayotte&#39;;
    if( $code == &#39;MX&#39; ) $country = &#39;Mexico&#39;;
    if( $code == &#39;FM&#39; ) $country = &#39;Micronesia&#39;;
    if( $code == &#39;MD&#39; ) $country = &#39;Moldova&#39;;
    if( $code == &#39;MC&#39; ) $country = &#39;Monaco&#39;;
    if( $code == &#39;MN&#39; ) $country = &#39;Mongolia&#39;;
    if( $code == &#39;ME&#39; ) $country = &#39;Montenegro&#39;;
    if( $code == &#39;MS&#39; ) $country = &#39;Montserrat&#39;;
    if( $code == &#39;MA&#39; ) $country = &#39;Morocco&#39;;
    if( $code == &#39;MZ&#39; ) $country = &#39;Mozambique&#39;;
    if( $code == &#39;MM&#39; ) $country = &#39;Myanmar&#39;;
    if( $code == &#39;NA&#39; ) $country = &#39;Namibia&#39;;
    if( $code == &#39;NR&#39; ) $country = &#39;Nauru&#39;;
    if( $code == &#39;NP&#39; ) $country = &#39;Nepal&#39;;
    if( $code == &#39;AN&#39; ) $country = &#39;Netherlands Antilles&#39;;
    if( $code == &#39;NL&#39; ) $country = &#39;Netherlands the&#39;;
    if( $code == &#39;NC&#39; ) $country = &#39;New Caledonia&#39;;
    if( $code == &#39;NZ&#39; ) $country = &#39;New Zealand&#39;;
    if( $code == &#39;NI&#39; ) $country = &#39;Nicaragua&#39;;
    if( $code == &#39;NE&#39; ) $country = &#39;Niger&#39;;
    if( $code == &#39;NG&#39; ) $country = &#39;Nigeria&#39;;
    if( $code == &#39;NU&#39; ) $country = &#39;Niue&#39;;
    if( $code == &#39;NF&#39; ) $country = &#39;Norfolk Island&#39;;
    if( $code == &#39;MP&#39; ) $country = &#39;Northern Mariana Islands&#39;;
    if( $code == &#39;NO&#39; ) $country = &#39;Norway&#39;;
    if( $code == &#39;OM&#39; ) $country = &#39;Oman&#39;;
    if( $code == &#39;PK&#39; ) $country = &#39;Pakistan&#39;;
    if( $code == &#39;PW&#39; ) $country = &#39;Palau&#39;;
    if( $code == &#39;PS&#39; ) $country = &#39;Palestinian Territory&#39;;
    if( $code == &#39;PA&#39; ) $country = &#39;Panama&#39;;
    if( $code == &#39;PG&#39; ) $country = &#39;Papua New Guinea&#39;;
    if( $code == &#39;PY&#39; ) $country = &#39;Paraguay&#39;;
    if( $code == &#39;PE&#39; ) $country = &#39;Peru&#39;;
    if( $code == &#39;PH&#39; ) $country = &#39;Philippines&#39;;
    if( $code == &#39;PN&#39; ) $country = &#39;Pitcairn Islands&#39;;
    if( $code == &#39;PL&#39; ) $country = &#39;Poland&#39;;
    if( $code == &#39;PT&#39; ) $country = &#39;Portugal, Portuguese Republic&#39;;
    if( $code == &#39;PR&#39; ) $country = &#39;Puerto Rico&#39;;
    if( $code == &#39;QA&#39; ) $country = &#39;Qatar&#39;;
    if( $code == &#39;RE&#39; ) $country = &#39;Reunion&#39;;
    if( $code == &#39;RO&#39; ) $country = &#39;Romania&#39;;
    if( $code == &#39;RU&#39; ) $country = &#39;Russian Federation&#39;;
    if( $code == &#39;RW&#39; ) $country = &#39;Rwanda&#39;;
    if( $code == &#39;BL&#39; ) $country = &#39;Saint Barthelemy&#39;;
    if( $code == &#39;SH&#39; ) $country = &#39;Saint Helena&#39;;
    if( $code == &#39;KN&#39; ) $country = &#39;Saint Kitts and Nevis&#39;;
    if( $code == &#39;LC&#39; ) $country = &#39;Saint Lucia&#39;;
    if( $code == &#39;MF&#39; ) $country = &#39;Saint Martin&#39;;
    if( $code == &#39;PM&#39; ) $country = &#39;Saint Pierre and Miquelon&#39;;
    if( $code == &#39;VC&#39; ) $country = &#39;Saint Vincent and the Grenadines&#39;;
    if( $code == &#39;WS&#39; ) $country = &#39;Samoa&#39;;
    if( $code == &#39;SM&#39; ) $country = &#39;San Marino&#39;;
    if( $code == &#39;ST&#39; ) $country = &#39;Sao Tome and Principe&#39;;
    if( $code == &#39;SA&#39; ) $country = &#39;Saudi Arabia&#39;;
    if( $code == &#39;SN&#39; ) $country = &#39;Senegal&#39;;
    if( $code == &#39;RS&#39; ) $country = &#39;Serbia&#39;;
    if( $code == &#39;SC&#39; ) $country = &#39;Seychelles&#39;;
    if( $code == &#39;SL&#39; ) $country = &#39;Sierra Leone&#39;;
    if( $code == &#39;SG&#39; ) $country = &#39;Singapore&#39;;
    if( $code == &#39;SK&#39; ) $country = &#39;Slovakia (Slovak Republic)&#39;;
    if( $code == &#39;SI&#39; ) $country = &#39;Slovenia&#39;;
    if( $code == &#39;SB&#39; ) $country = &#39;Solomon Islands&#39;;
    if( $code == &#39;SO&#39; ) $country = &#39;Somalia, Somali Republic&#39;;
    if( $code == &#39;ZA&#39; ) $country = &#39;South Africa&#39;;
    if( $code == &#39;GS&#39; ) $country = &#39;South Georgia and the South Sandwich Islands&#39;;
    if( $code == &#39;ES&#39; ) $country = &#39;Spain&#39;;
    if( $code == &#39;LK&#39; ) $country = &#39;Sri Lanka&#39;;
    if( $code == &#39;SD&#39; ) $country = &#39;Sudan&#39;;
    if( $code == &#39;SR&#39; ) $country = &#39;Suriname&#39;;
    if( $code == &#39;SJ&#39; ) $country = &#39;Svalbard &amp; Jan Mayen Islands&#39;;
    if( $code == &#39;SZ&#39; ) $country = &#39;Swaziland&#39;;
    if( $code == &#39;SE&#39; ) $country = &#39;Sweden&#39;;
    if( $code == &#39;CH&#39; ) $country = &#39;Switzerland, Swiss Confederation&#39;;
    if( $code == &#39;SY&#39; ) $country = &#39;Syrian Arab Republic&#39;;
    if( $code == &#39;TW&#39; ) $country = &#39;Taiwan&#39;;
    if( $code == &#39;TJ&#39; ) $country = &#39;Tajikistan&#39;;
    if( $code == &#39;TZ&#39; ) $country = &#39;Tanzania&#39;;
    if( $code == &#39;TH&#39; ) $country = &#39;Thailand&#39;;
    if( $code == &#39;TL&#39; ) $country = &#39;Timor-Leste&#39;;
    if( $code == &#39;TG&#39; ) $country = &#39;Togo&#39;;
    if( $code == &#39;TK&#39; ) $country = &#39;Tokelau&#39;;
    if( $code == &#39;TO&#39; ) $country = &#39;Tonga&#39;;
    if( $code == &#39;TT&#39; ) $country = &#39;Trinidad and Tobago&#39;;
    if( $code == &#39;TN&#39; ) $country = &#39;Tunisia&#39;;
    if( $code == &#39;TR&#39; ) $country = &#39;Turkey&#39;;
    if( $code == &#39;TM&#39; ) $country = &#39;Turkmenistan&#39;;
    if( $code == &#39;TC&#39; ) $country = &#39;Turks and Caicos Islands&#39;;
    if( $code == &#39;TV&#39; ) $country = &#39;Tuvalu&#39;;
    if( $code == &#39;UG&#39; ) $country = &#39;Uganda&#39;;
    if( $code == &#39;UA&#39; ) $country = &#39;Ukraine&#39;;
    if( $code == &#39;AE&#39; ) $country = &#39;United Arab Emirates&#39;;
    if( $code == &#39;GB&#39; ) $country = &#39;United Kingdom&#39;;
    if( $code == &#39;US&#39; ) $country = &#39;United States of America&#39;;
    if( $code == &#39;UM&#39; ) $country = &#39;United States Minor Outlying Islands&#39;;
    if( $code == &#39;VI&#39; ) $country = &#39;United States Virgin Islands&#39;;
    if( $code == &#39;UY&#39; ) $country = &#39;Uruguay, Eastern Republic of&#39;;
    if( $code == &#39;UZ&#39; ) $country = &#39;Uzbekistan&#39;;
    if( $code == &#39;VU&#39; ) $country = &#39;Vanuatu&#39;;
    if( $code == &#39;VE&#39; ) $country = &#39;Venezuela&#39;;
    if( $code == &#39;VN&#39; ) $country = &#39;Vietnam&#39;;
    if( $code == &#39;WF&#39; ) $country = &#39;Wallis and Futuna&#39;;
    if( $code == &#39;EH&#39; ) $country = &#39;Western Sahara&#39;;
    if( $code == &#39;YE&#39; ) $country = &#39;Yemen&#39;;
    if( $code == &#39;ZM&#39; ) $country = &#39;Zambia&#39;;
    if( $code == &#39;ZW&#39; ) $country = &#39;Zimbabwe&#39;;
    if( $country == &#39;&#39;) $country = $code;
    return $country;
}


?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Usage&lt;/span&gt;:-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

// for get United States of America use following syntax
echo getCountryName(&#39;US&#39;);



?&amp;gt;
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2014/08/get-country-from-alpha-2-code-in-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-7245559459801162398</guid><pubDate>Mon, 11 Aug 2014 16:42:00 +0000</pubDate><atom:updated>2014-08-11T22:14:26.834+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Compressed XML Sitemaps</category><category domain="http://www.blogger.com/atom/ns#">gzencode</category><category domain="http://www.blogger.com/atom/ns#">header</category><category domain="http://www.blogger.com/atom/ns#">sitemap.xml.gz</category><title>Create sitemap.xml.gz using PHP</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;In this in post we learn how to generate compressed XML sitemap with php. If some reason Apache does not support gzipping - old version, modules not enabled etc, you can use PHP to generate the compressed XML sitemap. PHP comes with a module of its own to generate gzipped content. Execute phpinfo() and look for the strings &quot;deflate&quot; and &quot;gzip&quot;, if you found them, you are ready to start outputting compressed content right away, all you have to do is send the header header(&#39;content-type: application/x-gzip&#39;) to send the content as a gzipped file.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Following example show you how you can do that:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$file_name = &#39;sitemap.xml&#39;;
header(&#39;content-type: application/x-gzip&#39;);
header(&#39;Content-Disposition: attachment; filename=&quot;&#39;.$file_name.&#39;.gz&quot;&#39;);
$data = &quot;dynamic XML sitemap string goes here&quot;;
$gzdata = gzencode($data, 9);
echo $gzdata;

?&amp;gt;
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2014/08/create-sitemapxmlgz-using-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-7682284392998523888</guid><pubDate>Wed, 06 Aug 2014 04:35:00 +0000</pubDate><atom:updated>2014-08-06T10:09:24.297+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">extract meta tags</category><category domain="http://www.blogger.com/atom/ns#">foreach</category><category domain="http://www.blogger.com/atom/ns#">get meta tags php</category><category domain="http://www.blogger.com/atom/ns#">get_html_translation_table</category><category domain="http://www.blogger.com/atom/ns#">get_meta_tags</category><category domain="http://www.blogger.com/atom/ns#">mb_detect_encoding</category><category domain="http://www.blogger.com/atom/ns#">meta tags</category><category domain="http://www.blogger.com/atom/ns#">preg_split</category><category domain="http://www.blogger.com/atom/ns#">utf8_decode</category><title>extract meta tag content in php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In last post we add script about grab webpage title tag and description , keywords meta tag content. But now this post we explain that how programmer can extract all the meta tags information from specific webpage with &lt;span style=&quot;color: red;&quot;&gt;&lt;a href=&quot;http://php.net/manual/en/function.get-meta-tags.php&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;get_meta_tags&lt;/a&gt;&lt;/span&gt; and returns an array.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


function get_meta_data($url, $searchkey=&#39;&#39;) {   
    $data = get_meta_tags($url);    // get the meta data in an array
    foreach($data as $key =&gt; $value) {
        if(mb_detect_encoding($value, &#39;UTF-8, ISO-8859-1&#39;, true) != &#39;ISO-8859-1&#39;) {    // check whether the content is UTF-8 or ISO-8859-1
            $value = utf8_decode($value);    // if UTF-8 decode it
        }
        $value = strtr($value, get_html_translation_table(HTML_ENTITIES));    // mask the content
        if($searchkey != &#39;&#39;) {    // if only one meta tag is in demand e.g. &#39;description&#39;
            if($key == $searchkey) {
                $str = $value;    // just return the value
            }
        } else {    // all meta tags
            $pattern = &#39;/ |,/i&#39;;    // &#39; &#39; or &#39;,&#39;
            $array = preg_split($pattern, $value, -1, PREG_SPLIT_NO_EMPTY);    // split it in an array, so we have the count of words           
            $str .= &#39;&lt;p&gt;&lt;span style=&quot;display:block;color:#000000;font-weight:bold;&quot;&gt;&#39; . $key . &#39; &lt;span style=&quot;font-weight:normal;&quot;&gt;(&#39; . count($array) . &#39; words | &#39; . strlen($value) . &#39; chars)&lt;/span&gt;&lt;/span&gt;&#39; . $value . &#39;&lt;/p&gt;&#39;;    // format data with count of words and chars
        }
    }
    return $str;
}

?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;How you can use &lt;b&gt;get_meta_data&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

$content = get_meta_data(&quot;http://4evertutorials.blogspot.com/&quot;); 

echo &quot;&lt;pre&gt;&quot;;
print_r($content);
echo &quot;&lt;/pre&gt;&quot;;



?&amp;gt;
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2014/08/extract-meta-tag-content-in-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-1231425201657777133</guid><pubDate>Mon, 04 Aug 2014 04:41:00 +0000</pubDate><atom:updated>2014-08-04T10:14:12.285+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">curl_init</category><category domain="http://www.blogger.com/atom/ns#">curl_setopt</category><category domain="http://www.blogger.com/atom/ns#">DOMDocument</category><category domain="http://www.blogger.com/atom/ns#">echo</category><category domain="http://www.blogger.com/atom/ns#">meta tags</category><category domain="http://www.blogger.com/atom/ns#">title tag</category><title>get title, meta tags info in php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This php script grab title tag and description, keywords meta of specified url with simple php curl function. And show all information in title tag , meta description and meta keywords tags.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

function file_get_contents_curl($url)
{
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    $data = curl_exec($ch);
    curl_close($ch);

    return $data;
}

$html = file_get_contents_curl(&quot;http://4evertutorials.blogspot.com/&quot;);

$doc = new DOMDocument();
@$doc-&gt;loadHTML($html);
$nodes = $doc-&gt;getElementsByTagName(&#39;title&#39;);
$title = $nodes-&gt;item(0)-&gt;nodeValue;
$metas = $doc-&gt;getElementsByTagName(&#39;meta&#39;);

for ($i = 0; $i &lt; $metas-&gt;length; $i++)
{
    $meta = $metas-&gt;item($i);
    if($meta-&gt;getAttribute(&#39;name&#39;) == &#39;description&#39;)
        $description = $meta-&gt;getAttribute(&#39;content&#39;);
    if($meta-&gt;getAttribute(&#39;name&#39;) == &#39;keywords&#39;)
        $keywords = $meta-&gt;getAttribute(&#39;content&#39;);
}

echo &quot;Title: $title&quot;. &#39;

&#39;;
echo &quot;Description: $description&quot;. &#39;

&#39;;
echo &quot;Keywords: $keywords&quot;;





?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
</description><link>http://4evertutorials.blogspot.com/2014/08/get-title-meta-tags-info-in-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-7442296079053947789</guid><pubDate>Fri, 01 Aug 2014 14:24:00 +0000</pubDate><atom:updated>2014-08-01T19:54:36.494+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">cpanel api</category><title>manage email accounts using cPanel API in php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;In this blog post we learn how php class can create and manage email accounts using the cPanel API. It can send HTTP requests to the cPanel API of a hosting account to perform several types of operations to manage email accounts.&lt;br /&gt;
&lt;br /&gt;
Currently this class has following functions:&lt;br /&gt;
- check if a given email account exists&lt;br /&gt;
- create a new email account&lt;br /&gt;
- get the list of created email accounts&lt;br /&gt;
- change the password of an email account &lt;br /&gt;
- delete an email account.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;For use this class first create a file name &quot;&lt;b&gt;class.email.php&lt;/b&gt;&quot; without double quote. And copy following code , paste and save.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


class cPanelEmailManager {
    private $cpanelHost;
    private $cpanelPort;
    private $username;
    private $password;
    private $logcurl;
    private $cookiefile;
    private $curlfile;
    private $emailArray;
    private $cpsess;

    /**
     * Constructor
     * @param string $user cPanel username
     * @param string $pass cPanel password
     * @param string $host cPanel domain
     * @param int $port cPanel domain
    */
    public function __construct($user,$pass,$host,$port=2083){
        $this-&gt;cpanelHost = $host;
        $this-&gt;cpanelPort = $port;
        $this-&gt;username = $user;
        $this-&gt;password = $pass;
        $this-&gt;logcurl = false;
        $this-&gt;cookiefile = &quot;cpmm/cpmm_cookie_&quot;.rand(99999, 9999999).&quot;.txt&quot;;
        $this-&gt;LogIn();
    }

    /**
     * Checks if an email address exists
     * @param string $Needle Email address to check
     * @param bool $FullEmailOnly If false, will return true with or without the domain attached
     * @return bool
    */
    public function emailExists($Needle, $FullEmailOnly = false){
        $Haystack = empty($this-&gt;emailArray) ? $this-&gt;getEmails() : $this-&gt;emailArray;
        foreach($Haystack as $H){
            if($FullEmailOnly === true &amp;&amp; $H[&#39;email&#39;] == $Needle){
                return true;
            }else if($FullEmailOnly !== true &amp;&amp; ($H[&#39;user&#39;] == $Needle || $H[&#39;email&#39;] == $Needle)){
                return true;
            }
        }
        return false;
    }

    /**
     * Creates a new email address
     * @param string $email Complete mail address to create, ie. myemail@mydomain.com
     * @param string $password Password for new email
     * @param string $quota Disk Space Quota, 0 for unlimited
     * @return bool
    */
    public function createEmail($email,$password,$quota = 0){
        if($this-&gt;emailExists($email,true)){
            return &quot;Email address &quot;.$email.&quot; already exist&quot;;
        }
        $e = explode(&quot;@&quot;,$email);
        $params = &#39;user=&#39;.$this-&gt;username.&#39;&amp;pass=&#39;.$this-&gt;password;;
        $url = &quot;https://&quot;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$this-&gt;cpsess.&quot;/json-api/cpanel&quot;.
        &quot;?cpanel_jsonapi_version=2&quot;.
        &quot;&amp;cpanel_jsonapi_func=addpop&quot;.
        &quot;&amp;cpanel_jsonapi_module=Email&amp;&quot;.
        &quot;email=&quot;.$e[0].&quot;&amp;&quot;.
        &quot;domain=&quot;.$e[1].&quot;&amp;&quot;.
        &quot;password=&quot;.urlencode($password).&quot;&amp;&quot;.
        &quot;quota=&quot;.$quota;
        $answer = json_decode($this-&gt;Request($url,$params), true);
        $this-&gt;getEmails(true);
        return ($answer[&quot;cpanelresult&quot;][&quot;data&quot;][0][&#39;result&#39;] === 1) ? true : false;
    }

    /**
     * Deletes an email address
     * @param string $email Complete mail address to delete, ie. myemail@mydomain.com
     * @return bool
    */
    public function deleteEmail($email){
        if(!$this-&gt;emailExists($email,true)){
            return &quot;Email address &quot;.$email.&quot; does not exist&quot;;
        }
        $e = explode(&quot;@&quot;,$email);
        $params = &#39;user=&#39;.$this-&gt;username.&#39;&amp;pass=&#39;.$this-&gt;password;;
        $url = &quot;https://&quot;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$this-&gt;cpsess.&quot;/json-api/cpanel&quot;.
        &quot;?cpanel_jsonapi_version=2&quot;.
        &quot;&amp;cpanel_jsonapi_func=delpop&quot;.
        &quot;&amp;cpanel_jsonapi_module=Email&amp;&quot;.
        &quot;email=&quot;.$e[0].&quot;&amp;&quot;.
        &quot;domain=&quot;.$e[1];
        $answer = json_decode($this-&gt;Request($url,$params), true);
        $this-&gt;getEmails(true);
        return ($answer[&quot;cpanelresult&quot;][&quot;data&quot;][0][&#39;result&#39;] === 1) ? true : false;
    }

    /**
     * Changes a password
     * @param string $email Complete email of account, ie. myemail@mydomain.com
     * @param string $newPW New password
     * @return bool
    */
    public function changePW($email, $newPW){
        if(!$this-&gt;emailExists($email,true)){
            return &quot;Email address &quot;.$email.&quot; does not exist&quot;;
        }
        $e = explode(&quot;@&quot;,$email);
        $params = &#39;user=&#39;.$this-&gt;username.&#39;&amp;pass=&#39;.$this-&gt;password;;
        $url = &quot;https://&quot;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$this-&gt;cpsess.&quot;/json-api/cpanel&quot;.
        &quot;?cpanel_jsonapi_version=2&quot;.
        &quot;&amp;cpanel_jsonapi_func=passwdpop&quot;.
        &quot;&amp;cpanel_jsonapi_module=Email&amp;&quot;.
        &quot;email=&quot;.$e[0].&quot;&amp;&quot;.
        &quot;domain=&quot;.$e[1].&quot;&amp;&quot;.
        &quot;password=&quot;.urlencode($newPW);
        $answer = json_decode($this-&gt;Request($url,$params), true);
        $this-&gt;getEmails(true);
        return ($answer[&quot;cpanelresult&quot;][&quot;data&quot;][0][&#39;result&#39;] === 1) ? true : false;
    }

    /**
     * Lists all email accounts and their properties
     * @param int $pageSize Number of results per page
     * @param int $currentPage Page number to start from
     * @param bool $paginate Return in pages
     * @param bool $sort Sort the results
     * @param bstring $sortby Column to sort by, ie. &quot;email&quot;, &quot;_diskused&quot;, &quot;mtime&quot;, or &quot;domain&quot;
     * @return array
    */
    public function listEmails($pageSize = 10, $currentPage = 1, $paginate = true, $sort = true, $sortby = &quot;user&quot;){
        $params = &#39;user=&#39;.$this-&gt;username.&#39;&amp;pass=&#39;.$this-&gt;password;;
        $url = &quot;https://&quot;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$this-&gt;cpsess.&quot;/json-api/cpanel&quot;.
        &quot;?cpanel_jsonapi_version=2&quot;.
        &quot;&amp;cpanel_jsonapi_func=listpopswithdisk&quot;.
        &quot;&amp;cpanel_jsonapi_module=Email&quot;.
        &quot;&amp;api2_paginate=&quot;.($paginate === false ? 0 : 1).
        &quot;&amp;api2_paginate_size=&quot;.$pageSize.
        &quot;&amp;api2_paginate_start=&quot;.$currentPage.
        &quot;&amp;api2_sort=&quot;.($sort === false ? 0 : 1).
        &quot;&amp;api2_sort_column=&quot;.$sortby.
        &quot;&amp;api2_sort_method=alphabet&quot;.
        &quot;&amp;api2_sort_reverse=0&quot;;
        $answer = $this-&gt;Request($url,$params);
        $emails = json_decode($answer, true);
        $this-&gt;emailArray = $emails[&quot;cpanelresult&quot;][&quot;data&quot;];
        return $this-&gt;emailArray;
    }

    /**
     * Turns cURL logging on
     * @param int $curlfile Path to curl log file
     * @return array
    */
    public function logCurl($curlfile = &quot;cpmm/cpmm_curl_log.txt&quot;){
        if(!file_exists($curlfile)){
            try{
                fopen($curlfile, &quot;w&quot;);
            }catch(Exception $ex){
                if(!file_exists($curlfile)){
                    return $ex.&#39;Cookie file missing.&#39;; exit;
                }
                return true;
            }
        }else if(!is_writable($curlfile)){
            return &#39;Cookie file not writable.&#39;; exit;
        }
        $this-&gt;logcurl = true;
        return true;
    }
    
    /**
     * Returns a complete list of emails and their properties
     * @access private
    */
    private function getEmails($refresh = false){
        if(!empty($this-&gt;emailArray) &amp;&amp; !$refresh){
            return $this-&gt;emailArray;
        }
        $params = &#39;user=&#39;.$this-&gt;username.&#39;&amp;pass=&#39;.$this-&gt;password;;
        $url = &quot;https://&quot;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$this-&gt;cpsess.&quot;/json-api/cpanel&quot;.
        &quot;?cpanel_jsonapi_version=2&quot;.
        &quot;&amp;cpanel_jsonapi_func=listpopswithdisk&quot;.
        &quot;&amp;cpanel_jsonapi_module=Email&quot;;
        $answer = $this-&gt;Request($url,$params);
        $emails = json_decode($answer, true);
        $this-&gt;emailArray = $emails[&quot;cpanelresult&quot;][&quot;data&quot;];
        return $this-&gt;emailArray;
    }

    /**
     * Starts a session on the cPanel server
     * @access private
    */
    private function LogIn(){
        $url = &#39;https://&#39;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.&quot;/login/?login_only=1&quot;;
        $url .= &quot;&amp;user=&quot;.$this-&gt;username.&quot;&amp;pass=&quot;.urlencode($this-&gt;password);
        $answer = $this-&gt;Request($url);
        $answer = json_decode($answer, true);
        if(isset($answer[&#39;status&#39;]) &amp;&amp; $answer[&#39;status&#39;] == 1){
            $this-&gt;cpsess = $answer[&#39;security_token&#39;];
            $this-&gt;homepage = &#39;https://&#39;.$this-&gt;cpanelHost.&quot;:&quot;.$this-&gt;cpanelPort.$answer[&#39;redirect&#39;];
        }
    }

    /**
     * Makes an HTTP request
     * @access private
    */
    private function Request($url,$params=array()){
        if($this-&gt;logcurl){
            $curl_log = fopen($this-&gt;curlfile, &#39;a+&#39;);
        }
        if(!file_exists($this-&gt;cookiefile)){
            try{
                fopen($this-&gt;cookiefile, &quot;w&quot;);
            }catch(Exception $ex){
                if(!file_exists($this-&gt;cookiefile)){
                    echo $ex.&#39;Cookie file missing.&#39;; exit;
                }
            }
        }else if(!is_writable($this-&gt;cookiefile)){
            echo &#39;Cookie file not writable.&#39;; exit;
        }
        $ch = curl_init();
        $curlOpts = array(
            CURLOPT_URL             =&gt; $url,
            CURLOPT_USERAGENT       =&gt; &#39;Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0&#39;,
            CURLOPT_SSL_VERIFYPEER  =&gt; false,
            CURLOPT_RETURNTRANSFER  =&gt; true,
            CURLOPT_COOKIEJAR       =&gt; realpath($this-&gt;cookiefile),
            CURLOPT_COOKIEFILE      =&gt; realpath($this-&gt;cookiefile),
            CURLOPT_FOLLOWLOCATION  =&gt; true,
            CURLOPT_HTTPHEADER      =&gt; array(
                &quot;Host: &quot;.$this-&gt;cpanelHost,
                &quot;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&quot;,
                &quot;Accept-Language: en-US,en;q=0.5&quot;,
                &quot;Accept-Encoding: gzip, deflate&quot;,
                &quot;Connection: keep-alive&quot;,
                &quot;Content-Type: application/x-www-form-urlencoded&quot;)
        );
        if(!empty($params)){
            $curlOpts[CURLOPT_POST] = true;
            $curlOpts[CURLOPT_POSTFIELDS] = $params;
        }
        if($this-&gt;logcurl){
            $curlOpts[CURLOPT_STDERR] = $curl_log;
            $curlOpts[CURLOPT_FAILONERROR] = false;
            $curlOpts[CURLOPT_VERBOSE] = true;
        }
        curl_setopt_array($ch,$curlOpts);
        $answer = curl_exec($ch);
        if (curl_error($ch)) {
            echo curl_error($ch); exit;
        }
        curl_close($ch);
        if($this-&gt;logcurl){
            fclose($curl_log);
        }
        return (@gzdecode($answer)) ? gzdecode($answer) : $answer;
    }
}



?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;b&gt;Following is working example:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/


	// include the library
	require(&quot;class.email.php&quot;);

	// cPanel domain or IP
	$host = &quot;mywebsite.com&quot;;

	// cPanel Username
	$user = &quot;cPanel_Username&quot;;

	// cPanel Password
	$pass = &quot;cPanel_Password&quot;;

	if($host == &quot;mywebsite.com&quot;){
	    echo &quot;Put your cPanel credentials in and remove line &quot;.__LINE__.&quot; from the example script before running.&quot;; exit;
	}

	// initialize the class
	$cpmm = new cPanelEmailManager($user, $pass, $host);

	// Create a new email address
	$email = &quot;newemail@mywebsite.com&quot;;
	$password = &quot;mybadpassword&quot;;
	$result = $cpmm-&gt;createEmail($email,$password);
	echo &quot;Email ($email) &quot;.($result ? &quot;successfully&quot; : &quot;not&quot;).&quot; created.&lt;br /&gt;&quot;;

	// Check if an email exists
	$email = &quot;newemail@mywebsite.com&quot;;
	$result = $cpmm-&gt;emailExists($email);
	echo &quot;Email ($email) &quot;.($result ? &quot;does&quot; : &quot;does not&quot;).&quot; exist.&lt;br /&gt;&quot;;

	// Change an email password
	$email = &quot;newemail@mywebsite.com&quot;;
	$newPassword = &quot;mybetterpassword&quot;;
	$result = $cpmm-&gt;changePW($email,$newPassword);
	echo ($result ? &quot;Changed&quot; : &quot;Could not change&quot;).&quot; password for email $email.&lt;br /&gt;&quot;;

	// Delete an email account
	$email = &quot;newemail@mywebsite.com&quot;;
	$result = $cpmm-&gt;deleteEmail($email);
	echo ($result ? &quot;Deleted&quot; : &quot;Could not delete&quot;).&quot; email account $email.&lt;br /&gt;&quot;;

	// List email accounts
	$pageSize = 15;
	$pageNo = 1;
	$result = $cpmm-&gt;listEmails($pageSize, $pageNo);
	
	var_dump($result);


?&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</description><link>http://4evertutorials.blogspot.com/2014/08/manage-email-accounts-using-cpanel-api.html</link><author>noreply@blogger.com (Web master)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-8892088141694579367</guid><pubDate>Thu, 31 Jul 2014 18:21:00 +0000</pubDate><atom:updated>2014-08-04T10:13:07.925+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">header</category><category domain="http://www.blogger.com/atom/ns#">http status</category><category domain="http://www.blogger.com/atom/ns#">redirect with php</category><title>redirect with HTTP status code in php</title><description>&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;PHP redirect script with all http status code. For further details please look at following code:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.com/
*/

function movePage($num,$url){
   static $http = array (
       100 =&gt; &quot;HTTP/1.1 100 Continue&quot;,
       101 =&gt; &quot;HTTP/1.1 101 Switching Protocols&quot;,
       200 =&gt; &quot;HTTP/1.1 200 OK&quot;,
       201 =&gt; &quot;HTTP/1.1 201 Created&quot;,
       202 =&gt; &quot;HTTP/1.1 202 Accepted&quot;,
       203 =&gt; &quot;HTTP/1.1 203 Non-Authoritative Information&quot;,
       204 =&gt; &quot;HTTP/1.1 204 No Content&quot;,
       205 =&gt; &quot;HTTP/1.1 205 Reset Content&quot;,
       206 =&gt; &quot;HTTP/1.1 206 Partial Content&quot;,
       300 =&gt; &quot;HTTP/1.1 300 Multiple Choices&quot;,
       301 =&gt; &quot;HTTP/1.1 301 Moved Permanently&quot;,
       302 =&gt; &quot;HTTP/1.1 302 Found&quot;,
       303 =&gt; &quot;HTTP/1.1 303 See Other&quot;,
       304 =&gt; &quot;HTTP/1.1 304 Not Modified&quot;,
       305 =&gt; &quot;HTTP/1.1 305 Use Proxy&quot;,
       307 =&gt; &quot;HTTP/1.1 307 Temporary Redirect&quot;,
       400 =&gt; &quot;HTTP/1.1 400 Bad Request&quot;,
       401 =&gt; &quot;HTTP/1.1 401 Unauthorized&quot;,
       402 =&gt; &quot;HTTP/1.1 402 Payment Required&quot;,
       403 =&gt; &quot;HTTP/1.1 403 Forbidden&quot;,
       404 =&gt; &quot;HTTP/1.1 404 Not Found&quot;,
       405 =&gt; &quot;HTTP/1.1 405 Method Not Allowed&quot;,
       406 =&gt; &quot;HTTP/1.1 406 Not Acceptable&quot;,
       407 =&gt; &quot;HTTP/1.1 407 Proxy Authentication Required&quot;,
       408 =&gt; &quot;HTTP/1.1 408 Request Time-out&quot;,
       409 =&gt; &quot;HTTP/1.1 409 Conflict&quot;,
       410 =&gt; &quot;HTTP/1.1 410 Gone&quot;,
       411 =&gt; &quot;HTTP/1.1 411 Length Required&quot;,
       412 =&gt; &quot;HTTP/1.1 412 Precondition Failed&quot;,
       413 =&gt; &quot;HTTP/1.1 413 Request Entity Too Large&quot;,
       414 =&gt; &quot;HTTP/1.1 414 Request-URI Too Large&quot;,
       415 =&gt; &quot;HTTP/1.1 415 Unsupported Media Type&quot;,
       416 =&gt; &quot;HTTP/1.1 416 Requested range not satisfiable&quot;,
       417 =&gt; &quot;HTTP/1.1 417 Expectation Failed&quot;,
       500 =&gt; &quot;HTTP/1.1 500 Internal Server Error&quot;,
       501 =&gt; &quot;HTTP/1.1 501 Not Implemented&quot;,
       502 =&gt; &quot;HTTP/1.1 502 Bad Gateway&quot;,
       503 =&gt; &quot;HTTP/1.1 503 Service Unavailable&quot;,
       504 =&gt; &quot;HTTP/1.1 504 Gateway Time-out&quot;
   );
   header($http[$num]);
   header (&quot;Location: $url&quot;);
   exit(0);
}



 
/* Move page with 301 http status code*/
movePage(301,&quot;http://4evertutorials.blogspot.com/&quot;);



?&amp;gt;
&lt;/pre&gt;</description><link>http://4evertutorials.blogspot.com/2014/07/redirect-with-http-status-code-in-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-992730193880291693</guid><pubDate>Tue, 22 Jul 2014 08:03:00 +0000</pubDate><atom:updated>2014-08-04T10:12:23.784+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">array</category><category domain="http://www.blogger.com/atom/ns#">foreach</category><category domain="http://www.blogger.com/atom/ns#">image color</category><title>grab image color php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This PHP class can extract the colors of a given image file. It can read an image in the GIF, JPEG or PNG format and extracts the list of colors that are used in the pixels of the image. The class takes in account a similarity factor to consider very similar colors as if they are the same. It returns an array with the colors used in the picture sorted by the frequency of the pixels that use each color.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Save following php code as a &quot;colorextractor.class.php&quot; without double quotes.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/

class ColorExtractor {
    private function RGBtoHEX($rgb) {
        $rgb = $rgb . &quot;,&quot;;
        preg_match(&quot;/(.*?)\,(.*?)\,(.*?)\,/&quot;, $rgb, $colors);
        $r   = $colors[1];
        $g   = $colors[2];
        $b   = $colors[3];
        $hex = &quot;#&quot;;
        $hex .= str_pad(dechex($r), 2, &quot;0&quot;, STR_PAD_LEFT);
        $hex .= str_pad(dechex($g), 2, &quot;0&quot;, STR_PAD_LEFT);
        $hex .= str_pad(dechex($b), 2, &quot;0&quot;, STR_PAD_LEFT);
        return $hex;
    }
    public function getColors($img, $num, $precision, $type) {
        $allArray  = array();
        $retArray  = array();
        $maxWidth  = 200;
        $maxHeight = 200;
        $cw        = 240;
        $num       = preg_replace(&#39;/[^0-9]/&#39;, &#39;&#39;, $num);
        $precision = preg_replace(&#39;/[^0-9]/&#39;, &#39;&#39;, $precision);
        if ($num == &quot;&quot;) {
            $num = 5;
        }
        if ($precision == &quot;&quot;) {
            $precision = 5;
        }
        if ($type != &quot;rgb&quot; &amp;&amp; $type != &quot;hex&quot;){
            $type = &quot;rgb&quot;;
        }
        $det = GetImageSize($img);
        if (!$det) {
            return &quot;Enter a valid Image&quot;;
        }
        $imgWidth  = $det[0];
        $imgHeight = $det[1];
        if ($imgWidth &gt; $maxWidth || $imgHeight &gt; $maxHeight) {
            if ($imgWidth &gt; $imgHeight) {
                $newWidth  = $maxWidth;
                $diff      = round($imgWidth / $maxWidth);
                $newHeight = round($imgHeight / $diff);
            } else {
                $newHeight = $maxHeight;
                $diff      = round($imgHeight / $maxHeight);
                $newWidth  = round($imgWidth / $diff);
            }
        }
        if ($det[2] == 1) {
            $origImage = imagecreatefromgif($img);
        } else if ($det[2] == 2) {
            $origImage = imagecreatefromjpeg($img);
        } else if ($det[2] == 3) {
            $origImage = imagecreatefrompng($img);
        }
        $newImage = imagecreatetruecolor($newWidth, $newHeight);
        imagecopyresampled($newImage, $origImage, 0, 0, 0, 0, $newWidth, $newHeight, $imgWidth, $imgHeight);
        for ($x = 0; $x &lt; $newWidth; $x++) {
            for ($y = 0; $y &lt; $newHeight; $y++) {
                $colors = imagecolorsforindex($newImage, imagecolorat($newImage, $x, $y));
                $r      = $colors[&#39;red&#39;];
                $g      = $colors[&#39;green&#39;];
                $b      = $colors[&#39;blue&#39;];
                $a      = $colors[&#39;alpha&#39;];
                if (!($r &gt; $cw &amp;&amp; $g &gt; $cw &amp;&amp; $b &gt; $cw)) {
                    if (!($r == 0 &amp;&amp; $g == 0 &amp;&amp; $b == 0)) {
                        $rgb = $r . &quot;,&quot; . $g . &quot;,&quot; . $b;
                        array_push($allArray, $rgb);
                    }
                }
            }
        }
        $count = array_count_values($allArray);
        arsort($count);
        $keys = array_keys($count);
        for ($s = 0; $s &lt; $num; $s++) {
            $first = $keys[$s] . &quot;,&quot;;
            preg_match(&quot;/(.*?)\,(.*?)\,(.*?)\,/&quot;, $first, $colors2);
            $r  = $colors2[1];
            $g  = $colors2[2];
            $b  = $colors2[3];
            $iS = $s + 1;
            for ($i = $iS; $i &lt; count($keys); $i++) {
                $next = $keys[$i] . &quot;,&quot;;
                preg_match(&quot;/(.*?)\,(.*?)\,(.*?)\,/&quot;, $next, $colors2);
                $r2 = $colors2[1];
                $g2 = $colors2[2];
                $b2 = $colors2[3];
                if (abs($r2 - $r) &lt; $precision || abs($g2 - $g) &lt; $precision || abs($g2 - $g) &lt; $precision) {
                    unset($keys[$i]);
                }
            }
            $keys = array_values($keys);
        }
        if ($type == &quot;hex&quot;) {
            for ($j = 0; $j &lt; $num; $j++) {
                $color = $this-&gt;RGBtoHEX($keys[$j]);
                array_push($retArray, $color);
            }
        } else if ($type == &quot;rgb&quot;){
            for ($j = 0; $j &lt; $num; $j++) {
                array_push($retArray, $keys[$j]);
            }
        }
        return $retArray;
    }
}

?&amp;gt;
&lt;/pre&gt;
&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Usage of class:&lt;/span&gt;


&lt;span style=&quot;background-color: #d9ead3;&quot;&gt;&amp;lt;?php

//Require the ColorExtractor Class
require(&quot;colorextractor.class.php&quot;);

$img = &quot;https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRveQ2t7dRmKi1aq54eHUEto2OfDyxmfIZn--lVvye_Hxc2eJ59&quot;;

$ce = new ColorExtractor;

/*
Call the function getColors, this function gets the main colors from the image
getColors(Link to Image, Number of colors to return, minumum difference between each color, Type of return &quot;rgb&quot; or &quot;hex&quot;);
*/
$colorArray = $ce-&amp;gt;getColors($img, 5,Â 11, &quot;rgb&quot;);

?&amp;gt;&lt;/span&gt;

&amp;lt;img src=&quot;&amp;lt;?php echo $img; ?&amp;gt;&quot;&amp;gt;

&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;

&amp;lt;table width=&quot;200px&quot; border=&quot;1&quot;&amp;gt;

&lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;&amp;lt;?php
foreach ($colorArray as $color) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &#39;&amp;lt;tr&amp;gt;&#39;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (substr($color, 0, 1) == &quot;#&quot;) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &#39;&amp;lt;td width=&quot;50%&quot; align=&quot;center&quot;&amp;gt;&#39; . $color . &#39;&amp;lt;/td&amp;gt;&amp;lt;td width=&quot;50%&quot; align=&quot;center&quot;&amp;gt;&amp;lt;div style=&quot;background-color:&#39; . $color . &#39;; width:50px; height:50px;&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&#39;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &#39;&amp;lt;td width=&quot;50%&quot; align=&quot;center&quot;&amp;gt;&#39; . $color . &#39;&amp;lt;/td&amp;gt;&amp;lt;td width=&quot;50%&quot; align=&quot;center&quot;&amp;gt;&amp;lt;div style=&quot;background-color:rgb(&#39; . $color . &#39;); width:50px; height:50px;&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&#39;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &#39;&amp;lt;/tr&amp;gt;&#39;;
}
?&amp;gt;&lt;/span&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
</description><link>http://4evertutorials.blogspot.com/2014/07/grab-image-color-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3367788962846719795.post-7529370998185040565</guid><pubDate>Fri, 04 Jul 2014 17:21:00 +0000</pubDate><atom:updated>2014-07-04T22:51:20.483+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">resize image photo</category><title>resize image using php</title><description>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;PHP script can easily allow you to resize image using php class. If you’re looking to resize uploaded images or would want to generate thumbnails from uploaded images, then just try this php class once. It also works on transparent PNG and GIF images.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/

class ResizeImage {
 
   var $image;
   var $image_type;
 
   function load($filename) {
 
      $image_info = getimagesize($filename);
      $this-&gt;image_type = $image_info[2];
      if( $this-&gt;image_type == IMAGETYPE_JPEG ) {
 
         $this-&gt;image = imagecreatefromjpeg($filename);
      } elseif( $this-&gt;image_type == IMAGETYPE_GIF ) {
 
         $this-&gt;image = imagecreatefromgif($filename);
      } elseif( $this-&gt;image_type == IMAGETYPE_PNG ) {
 
         $this-&gt;image = imagecreatefrompng($filename);
      }
   }
   function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
 
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this-&gt;image,$filename,$compression);
      } elseif( $image_type == IMAGETYPE_GIF ) {
 
         imagegif($this-&gt;image,$filename);
      } elseif( $image_type == IMAGETYPE_PNG ) {
 
         imagepng($this-&gt;image,$filename);
      }
      if( $permissions != null) {
 
         chmod($filename,$permissions);
      }
   }
   function output($image_type=IMAGETYPE_JPEG) {
 
      if( $image_type == IMAGETYPE_JPEG ) {
         imagejpeg($this-&gt;image);
      } elseif( $image_type == IMAGETYPE_GIF ) {
 
         imagegif($this-&gt;image);
      } elseif( $image_type == IMAGETYPE_PNG ) {
 
         imagepng($this-&gt;image);
      }
   }
   function getWidth() {
 
      return imagesx($this-&gt;image);
   }
   function getHeight() {
 
      return imagesy($this-&gt;image);
   }
   function resizeToHeight($height) {
 
      $ratio = $height / $this-&gt;getHeight();
      $width = $this-&gt;getWidth() * $ratio;
      $this-&gt;resize($width,$height);
   }
 
   function resizeToWidth($width) {
      $ratio = $width / $this-&gt;getWidth();
      $height = $this-&gt;getheight() * $ratio;
      $this-&gt;resize($width,$height);
   }
 
   function scale($scale) {
      $width = $this-&gt;getWidth() * $scale/100;
      $height = $this-&gt;getheight() * $scale/100;
      $this-&gt;resize($width,$height);
   }
 
   function resize($width,$height) {
      $new_image = imagecreatetruecolor($width, $height);
      imagecopyresampled($new_image, $this-&gt;image, 0, 0, 0, 0, $width, $height, $this-&gt;getWidth(), $this-&gt;getHeight());
      $this-&gt;image = $new_image;
   }

   function resizeTransparentImage($width,$height) {
    $new_image = imagecreatetruecolor($width, $height);
    if( $this-&gt;image_type == IMAGETYPE_GIF || $this-&gt;image_type == IMAGETYPE_PNG ) {
        $current_transparent = imagecolortransparent($this-&gt;image);
        if($current_transparent != -1) {
            $transparent_color = imagecolorsforindex($this-&gt;image, $current_transparent);
            $current_transparent = imagecolorallocate($new_image, $transparent_color[&#39;red&#39;], $transparent_color[&#39;green&#39;], $transparent_color[&#39;blue&#39;]);
            imagefill($new_image, 0, 0, $current_transparent);
            imagecolortransparent($new_image, $current_transparent);
        } elseif( $this-&gt;image_type == IMAGETYPE_PNG) {
            imagealphablending($new_image, false);
            $color = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
            imagefill($new_image, 0, 0, $color);
            imagesavealpha($new_image, true);
        }
    }
    imagecopyresampled($new_image, $this-&gt;image, 0, 0, 0, 0, $width, $height, $this-&gt;getWidth(), $this-&gt;getHeight());
    $this-&gt;image = $new_image; 
  }
 
}

?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 1 :&lt;br /&gt;
&lt;br /&gt;
The first example below will load a file named picture.jpg resize it to 250 pixels wide and 400 pixels high and resave it as picture2.jpg&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/

   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.$file_location.&#39;picture.jpg&#39;);
   $image-&gt;resize(250,400);
   $image-&gt;save(&#39;picture2.jpg&#39;);
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 2 :&lt;br /&gt;
&lt;br /&gt;
If you want to resize to a specifed width but keep the dimensions ratio the same then the script can work out the required height for you, just use the resizeToWidth function.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.&#39;picture.jpg&#39;);
   $image-&gt;resizeToWidth(250);
   $image-&gt;save(&#39;picture2.jpg&#39;);
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 3 :&lt;br /&gt;
&lt;br /&gt;
You may wish to scale an image to a specified percentage like the following which will resize the image to 50% of its original width and height&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.&#39;picture.jpg&#39;);
   $image-&gt;scale(50);
   $image-&gt;save(&#39;picture2.jpg&#39;);
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 4 :&lt;br /&gt;
&lt;br /&gt;
You can of course do more than one thing at once. The following example will create two new images with heights of 200 pixels and 500 pixels&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.&#39;picture.jpg&#39;);
   $image-&gt;resizeToHeight(500);
   $image-&gt;save(&#39;picture2.jpg&#39;);
   $image-&gt;resizeToHeight(200);
   $image-&gt;save(&#39;picture3.jpg&#39;);
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 5 :&lt;br /&gt;
&lt;br /&gt;
The output function lets you output the image straight to the browser without having to save the file. Its useful for on the fly thumbnail generation&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   header(&#39;Content-Type: image/jpeg&#39;);
   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.&#39;picture.jpg&#39;);
   $image-&gt;resizeToWidth(150);
   $image-&gt;output();
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 6 :&lt;br /&gt;
&lt;br /&gt;
Resize Transparent gif OR png images&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   $file_location = &#39;/var/www/yourwebsite/uploads/&#39;; # Image folder Path
  $image = new ResizeImage();
   $image-&gt;load($file_location.&#39;picture.jpg&#39;);
   $image-&gt;resizeTransparentImage(250,400);
   $image-&gt;save(&#39;picture2.jpg&#39;);
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Usage 7 :&lt;br /&gt;
&lt;br /&gt;
The following example will resize and save an image which has been uploaded via a form&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre name=&quot;code&quot; class=&quot;php:firstline[10]&quot;&gt;&amp;lt;?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
   if( isset($_POST[&#39;submit&#39;]) ) {
      $image = new ResizeImage();
      $image-&gt;load($_FILES[&#39;uploaded_image&#39;][&#39;tmp_name&#39;]);
      $image-&gt;resizeToWidth(150);
      $image-&gt;output();
   } else {
 

 
   echo &#39;&lt;form action=&quot;&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;      &lt;input type=&quot;file&quot; name=&quot;uploaded_image&quot; /&gt;
 
      &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Upload&quot; /&gt;
 
   &lt;/form&gt;&#39;;
 
   }
?&amp;gt;
&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;If you have any queries or feedback for this script then please Leave A Response below. Thank You. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://4evertutorials.blogspot.com/2014/07/resize-image-using-php.html</link><author>noreply@blogger.com (Web master)</author><thr:total>0</thr:total></item></channel></rss>