<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Php Development &#187; PHP/mysql</title>
	<atom:link href="http://www.maheshchari.com/category/php-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maheshchari.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 23 May 2010 05:10:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>php auto append ,prepend file using htaccess</title>
		<link>http://www.maheshchari.com/php-auto-append-prepend-file-using-htaccess/</link>
		<comments>http://www.maheshchari.com/php-auto-append-prepend-file-using-htaccess/#comments</comments>
		<pubDate>Sun, 23 May 2010 05:10:57 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=553</guid>
		<description><![CDATA[Automatically append and prepend a php file to current script using htaccess
It is best practice to add common file to every php script in our application ,such as libraries  cleaning input variables from $_GET,$_POST,$_COOKIE,cleaning or modifying the output of the php script by providing plug in functionality. 
We know best example for this many [...]]]></description>
			<content:encoded><![CDATA[<h1>Automatically append and prepend a php file to current script using htaccess</h1>
<p>It is best practice to add common file to every php script in our application ,such as libraries  cleaning input variables from $_GET,$_POST,$_COOKIE,cleaning or modifying the output of the php script by providing plug in functionality. </p>
<p>We know best example for this many free hosting providers use this settings. they append a advertisement script to our files while it output buffering.</p>
<p>here we learn how to add or remove append or prepend files using htaccess. to continue this tutorial we must have the knowledge of htaccess of apache and basic settings in php.ini</p>
<h2>add files to script</h2>
<p>this can be achieved by  <b>auto_append_file</b> and <b>auto_prepend_file</b> php  configuration options.These options can be set in the PHP config, virtual host settings or in a .htaccess file. This post shows how to set these and how to override a setting so no file is appended or prepended.</p>
<h3>Example</h3>
<p>We have three files append.php, mainscript.php, prepend.php and htaccess file to achieve this.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//prepend.php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;p&gt;this is the prepended file&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//mainscript.php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;p&gt;this is the main file&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//append.php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;p&gt;this is the appended file&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h2>Out put of our mainscript file</h2>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p&gt;this is the prepended file&lt;/p&gt;
&lt;p&gt;this is the main file&lt;/p&gt;
&lt;p&gt;this is the appended file&lt;/p&gt;</pre></div></div>

<h2>Set up php values in htaccess</h2>
<p>prepending a file</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">php_value auto_prepend_file prepend.php</pre></div></div>

<p>Append a file</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">php_value auto_prepend_file append.php</pre></div></div>

<h2>Removing or modify existing values</h2>
<p>we can override these values for each php file or each directory in our application. we can remove existing auto_append ,auto_prepend values by setting its values to none.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">php_value auto_append_file none
php_value auto_prepend_file none</pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=553&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/php-auto-append-prepend-file-using-htaccess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>list tables in mysql database with php</title>
		<link>http://www.maheshchari.com/list-tables-in-mysql-database-with-php/</link>
		<comments>http://www.maheshchari.com/list-tables-in-mysql-database-with-php/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 02:54:41 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=550</guid>
		<description><![CDATA[How to display mysql tables in given database using php
we know that it common practice to list database tables in mysql related backup php scripts.we learn here how to display the tables in given mysql database. for that we need to select a database and create some test tables with below queries .

CREATE TABLE  [...]]]></description>
			<content:encoded><![CDATA[<h1>How to display mysql tables in given database using php</h1>
<p>we know that it common practice to list database tables in mysql related backup php scripts.we learn here how to display the tables in given mysql database. for that we need to select a database and create some test tables with below queries .</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">CREATE TABLE  `testtable` (
  `test_id` int(10) unsigned NOT NULL auto_increment,
  `test_name` varchar(45) NOT NULL,
  `test_created` datetime NOT NULL,
  PRIMARY KEY  (`test_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&nbsp;
CREATE TABLE  `testtable1` (
  `test_id1` int(10) unsigned NOT NULL auto_increment,
  `test_name1` varchar(45) NOT NULL,
  `test_created1` datetime NOT NULL,
  PRIMARY KEY  (`test_id1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&nbsp;
CREATE TABLE  `testtable2` (
  `test_id2` int(10) unsigned NOT NULL auto_increment,
  `test_name2` varchar(45) NOT NULL,
  `test_created2` datetime NOT NULL,
  PRIMARY KEY  (`test_id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
&nbsp;
&nbsp;
CREATE TABLE  `testtable3` (
  `test_id3` int(10) unsigned NOT NULL auto_increment,
  `test_name3` varchar(45) NOT NULL,
  `test_created3` datetime NOT NULL,
  PRIMARY KEY  (`test_id3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;</pre></div></div>

<h3>Code Example</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//replace it with your host normally it could be localhost</span>
<span style="color: #000088;">$hostname</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//mysql user name</span>
<span style="color: #000088;">$username</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'root'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//mysql user password</span>
<span style="color: #000088;">$password</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//connect to the mysql server</span>
<span style="color: #000088;">$ss</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_pconnect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hostname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">E_USER_ERROR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//select a database on the mysql server</span>
<span style="color: #666666; font-style: italic;">//please change as you like the database name</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//SHOW COLUMNS FROM TABLENAME</span>
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SHOW TABLES '</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//iterate trough the query result and fetch each field</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//collect each field into a array</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//test the fields array</span></pre></div></div>

<h3>Output</h3>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Array
(
    [0] =&gt; testtable
    [1] =&gt; testtable1
    [2] =&gt; testtable2
    [3] =&gt; testtable3
)</pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=550&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/list-tables-in-mysql-database-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>print mysql table fields</title>
		<link>http://www.maheshchari.com/print-mysql-table-fields/</link>
		<comments>http://www.maheshchari.com/print-mysql-table-fields/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 13:40:29 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=546</guid>
		<description><![CDATA[How to display mysql table fields using PHP
It is common to find the mysql table field names  in the given table while creating dynamic models for our web applications.To continue this tutorial we have to create a test table. Below mysql query is used to create this test table.

CREATE TABLE  `testtable` (
  [...]]]></description>
			<content:encoded><![CDATA[<h1>How to display mysql table fields using PHP</h1>
<p>It is common to find the mysql table field names  in the given table while creating dynamic models for our web applications.To continue this tutorial we have to create a test table. Below mysql query is used to create this test table.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">CREATE TABLE  `testtable` (
  `test_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `test_name` VARCHAR(45) NOT NULL,
  `test_created` DATETIME NOT NULL,
  PRIMARY KEY (`test_id`)
)
ENGINE = InnoDB;</pre></div></div>

<p><P><b>SHOW COLUMNS FROM<b> TABLENAME  query is used for list the mysql fields.</P></p>
<p>below code lists the mysql table fields.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  
<span style="color: #666666; font-style: italic;">//replace it with your host normally it could be localhost</span>
<span style="color: #000088;">$hostname</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//mysql user name</span>
<span style="color: #000088;">$username</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//mysql user password</span>
<span style="color: #000088;">$password</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//connect to the mysql server</span>
<span style="color: #000088;">$ss</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_pconnect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$hostname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">E_USER_ERROR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//select a database on the mysql server</span>
<span style="color: #666666; font-style: italic;">//please change as you like the database name</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mydatabase'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//SHOW COLUMNS FROM TABLENAME</span>
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SHOW COLUMNS FROM testtable '</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//iterate trough the query result and fetch each field</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$field</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$field</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//collect each field into a array</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//test the fields array</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$field</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$field</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Field</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/br&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// print each field name</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=546&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/print-mysql-table-fields/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Upload Image File To Remote Server With PHP cURL</title>
		<link>http://www.maheshchari.com/upload-image-file-to-remote-server-with-php-curl/</link>
		<comments>http://www.maheshchari.com/upload-image-file-to-remote-server-with-php-curl/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 23:40:55 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=538</guid>
		<description><![CDATA[How to upload image file to remote server with PHP cURL
In this example we learn how to upload static files to remote server using PHP cURL library.
We must know following functionality before we continue this example

PHP file upload functionality.
cURL function reference.
how to submit data to remote server with PHP cURL

Files and Folders
Download Example
For this example [...]]]></description>
			<content:encoded><![CDATA[<h1>How to upload image file to remote server with PHP cURL</h1>
<p>In this example we learn how to upload static files to remote server using PHP cURL library.</p>
<h3>We must know following functionality before we continue this example</h3>
<ul>
<li><a href="http://www.maheshchari.com/simple-php-file-upload-tutorial/" target="_blank">PHP file upload functionality.</a></li>
<li><a href="http://www.maheshchari.com/php-curl-basic-reference/">cURL function reference.</a></li>
<li><a href="http://www.maheshchari.com/submitting-form-to-remote-server-with-array-of-parameters/" target="_blank">how to submit data to remote server with PHP cURL</a></li>
</ul>
<h3>Files and Folders</h3>
<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/curl_image.zip'>Download Example</a></h3>
<p>For this example we use three files </p>
<ul>
<li><strong>uploader.php</strong> -that receives the files on to the remote server.</li>
<li><strong>handler.php</strong> -is used to web based client to upload the file.</li>
<li><strong>curl_handler.php</strong> -PHP cURL uploading client to upload file.</li>
</ul>
<p>Since we use same host to both local and remote server ,we create separate directories</p>
<ul>
<li><strong>local_files/ </strong>- these files will be uploaded to the remote server ,means to <strong>uploaded_files</strong> directory.</li>
<li><strong>uploaded_files/</strong> &#8211; these files are from the uploading client from both <strong>web based </strong>and <strong>PHP cURL based</strong>.</li>
</ul>
<h3>uploader.php</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000088;">$upload_directory</span><span style="color: #339933;">=</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/uploaded_files/'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//check if form submitted</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			<span style="color: #666666; font-style: italic;">//check for image submitted</span>
    		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			<span style="color: #666666; font-style: italic;">// check for error re file</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Error: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;my_file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">//move temp file to our server            </span>
			<span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> 
			<span style="color: #000088;">$upload_directory</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_file'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Uploaded File.'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	        <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'File not uploaded.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
			<span style="color: #666666; font-style: italic;">// exit script</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>handler.php</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form action=&quot;uploader.php&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot; name=&quot;form1&quot; id=&quot;form1&quot;&gt;
  &lt;input type=&quot;file&quot; name=&quot;my_file&quot; id=&quot;my_file&quot; /&gt;
  &lt;input type=&quot;submit&quot; name=&quot;upload&quot; id=&quot;upload&quot; value=&quot;Upload&quot; /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h3>curl_handler.php</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$local_directory</span><span style="color: #339933;">=</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/local_files/'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_VERBOSE<span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Mozilla/4.0 (compatible;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://localhost/curl_image/uploader.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//most importent curl assues @filed as file field</span>
    <span style="color: #000088;">$post_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;my_file&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;@&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$local_directory</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'shreya.jpg'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">&quot;upload&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Upload&quot;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$post_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$response</span><span style="color: #339933;">;</span></pre></div></div>

<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/curl_image.zip'>Download Example</a></h3>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=538&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/upload-image-file-to-remote-server-with-php-curl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serve your PHP file as JavaScript file</title>
		<link>http://www.maheshchari.com/serve-your-php-file-as-javascript-file/</link>
		<comments>http://www.maheshchari.com/serve-your-php-file-as-javascript-file/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 17:23:17 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=523</guid>
		<description><![CDATA[Serve Your PHP script as JavaScript file.
Some times we need to serve user based JavaScript files, for example

passing your php variables to JavaScript on client side of browser.
protecting JavaScript variables.
setting browser cache manually for JavaScript files.
loading user based java script files.
for easy versification of your JavaScript files.

Download Demo
Suppose your php-javascript file &#8220;my-phpjavascript.js.php&#8221; ,now you can [...]]]></description>
			<content:encoded><![CDATA[<h1>Serve Your PHP script as JavaScript file.</h1>
<p>Some times we need to serve user based JavaScript files, for example</p>
<ul>
<li>passing your php variables to JavaScript on client side of browser.</li>
<li>protecting JavaScript variables.</li>
<li>setting browser cache manually for JavaScript files.</li>
<li>loading user based java script files.</li>
<li>for easy versification of your JavaScript files.</li>
</ul>
<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/wp.zip'>Download Demo</a></h3>
<p>Suppose your php-javascript file &#8220;<b>my-phpjavascript.js.php</b>&#8221; ,now you can add this file as below example.</p>
<h3>Client HTML code</h3>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;script  type=&quot;text/javascript&quot; src=&quot;my-phpjavascript.js.php&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script&gt;
alert(site_name);
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h3>my-phpjavascript.js.php code</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #666666; font-style: italic;">// this is PHP variable</span>
<span style="color: #000088;">$sitename</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;My PHP development blog.&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
//this is javascript variable 
var site_name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$sitename</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;;</pre></div></div>

<p>some browsers don&#8217;t recognize this php file as javascript ,so to make all browser compatibility we have to send javascript headers to browser ,we can do that by adding a few line of code at starting of php script. </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Content-Type: text/javascript; charset=utf-8&quot;</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Remember to preview this code you must installed PHP</p>
<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/03/wp.zip'>Download Demo</a></h3>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=523&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/serve-your-php-file-as-javascript-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Submitting form to remote server with array of parameters</title>
		<link>http://www.maheshchari.com/submitting-form-to-remote-server-with-array-of-parameters/</link>
		<comments>http://www.maheshchari.com/submitting-form-to-remote-server-with-array-of-parameters/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 01:04:34 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[curl]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=454</guid>
		<description><![CDATA[submit a form with post method to remote server using php curl
We learn how to submit the form data to remote server in my previous example with URL string.
Here we can pass data with POST multipart method,main difference is that we passs it as array.
To submit forms using cURL, we need to follow the below [...]]]></description>
			<content:encoded><![CDATA[<h1>submit a form with post method to remote server using php curl</h1>
<p>We learn how to submit the form data to remote server in my <a href="http://www.maheshchari.com/submit-a-form-to-remote-server-with-php-curl/">previous example</a> with URL string.<br />
Here we can pass data with POST multipart method,main difference is that we passs it as array.</p>
<p>To submit forms using cURL, we need to follow the below steps:</p>
<p> 1. Prepare the data to be posted<br />
  2. Connect to the remote URL<br />
  3. Post (submit) the data<br />
  4. Fetch response and display it to the user or do some other stuff with it.</p>
<p>Below Example Has two files,one to post the data and other is to process the data.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * Data which is to submitted to the remote URL
 */</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$post_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fname'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'mahesh'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'lname'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'chari'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Initialize cURL and connect to the remote URL
 * You will need to replace the URL with your own server's URL
 * or wherever you uploaded this script to. 
 */</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://example.com/curlpost_handler.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Instruct cURL to do a regular HTTP POST
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Specify the data which is to be posted
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$post_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Tell curl_exec to return the response output as a string
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Execute the cURL session
 */</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Close cURL session and file
 */</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$response</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// is Welcome Maheshchari.</span></pre></div></div>

<p>Handling post data on curlpost_hanlder.php </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$firstname</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lastname</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Welcome <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;.</span><span style="color: #000088;">$firstname</span><span style="color: #339933;">.</span><span style="color: #000088;">$lastname</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=454&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/submitting-form-to-remote-server-with-array-of-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>submit a form to remote server with php curl</title>
		<link>http://www.maheshchari.com/submit-a-form-to-remote-server-with-php-curl/</link>
		<comments>http://www.maheshchari.com/submit-a-form-to-remote-server-with-php-curl/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 01:00:03 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[curl]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=451</guid>
		<description><![CDATA[Submitting form to remote server.
We learned some basics in my previous article cURL basics. Here we cover a topic how to submit a form to remote server.
To submit forms using cURL, we need to follow the below steps:
 1. Prepare the data to be posted
  2. Connect to the remote URL
  3. Post [...]]]></description>
			<content:encoded><![CDATA[<h1>Submitting form to remote server.</h1>
<p>We learned some basics in my <a href="http://www.maheshchari.com/php-curl-basic-reference/" target="_blank">previous article</a> cURL basics. Here we cover a topic how to submit a form to remote server.</p>
<p>To submit forms using cURL, we need to follow the below steps:</p>
<p> 1. Prepare the data to be posted<br />
  2. Connect to the remote URL<br />
  3. Post (submit) the data<br />
4. Fetch response and display it to the user or do some other stuff with it.</p>
<p>Below Example Has two files,one to post the data and other is to process the data.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * Data which is to submitted to the remote URL
 */</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$post_str</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;fname=mahesh&amp;lname=chari&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Initialize cURL and connect to the remote URL
 * You will need to replace the URL with your own server's URL
 * or wherever you uploaded this script to. 
 */</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://example.com/curlpost_handler.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Instruct cURL to do a regular HTTP POST
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Specify the data which is to be posted
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$post_str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
 * Tell curl_exec to return the response output as a string
 */</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Execute the cURL session
 */</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Close cURL session and file
 */</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$response</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// is Welcome Maheshchari.</span></pre></div></div>

<p>Handling post data on curlpost_hanlder.php </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$firstname</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$lastname</span><span style="color: #339933;">=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Welcome &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$firstname</span><span style="color: #339933;">.</span><span style="color: #000088;">$lastname</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=451&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/submit-a-form-to-remote-server-with-php-curl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php curl basic reference</title>
		<link>http://www.maheshchari.com/php-curl-basic-reference/</link>
		<comments>http://www.maheshchari.com/php-curl-basic-reference/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 00:54:50 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>
		<category><![CDATA[curl]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=448</guid>
		<description><![CDATA[cURL basics and functions over view
cURL is a PHP library which allows you to  connect and communicate to many different types of servers with many  different types of protocols.Main difference is it has session capability unlik fopen. We can make small scale robot script with cURL functions in PHP.
With  cURL we can:

Implement [...]]]></description>
			<content:encoded><![CDATA[<h1>cURL basics and functions over view</h1>
<p>cURL is a PHP library which allows you to  connect and communicate to many different types of servers with many  different types of protocols.Main difference is it has session capability unlik <a href="http://php.net/manual/en/function.fopen.php" target="_blank">fopen</a>. We can make small scale robot script with cURL functions in PHP.</p>
<p>With  cURL we can:</p>
<ul>
<li>Implement payment gateways’ payment notification scripts.</li>
<li>Download and upload files from remote servers.</li>
<li>Login to other websites and access members only sections.</li>
<li>Cross site communication with PHP backend and Ajax.</li>
</ul>
<p>PHP cURL library is definitely the odd man out. Unlike other PHP libraries where a whole plethora of functions is made available, PHP cURL wraps up a major parts of its functionality with following functions.</p>
<p>Curl functions are:</p>
<ol>
<li>  <strong>curl_close</strong> — Close a cURL session</li>
<li>    <strong>curl_copy_handle </strong>— Copy a cURL handle along with all of its preferences</li>
<li>    <strong>curl_errno</strong> — Return the last error number</li>
<li>    <strong>curl_error</strong> — Return a string containing the last error for the current session</li>
<li>    <strong>curl_exec</strong> — Perform a cURL session</li>
<li><strong>curl_getinfo</strong> — Get information regarding a specific transfer</li>
<li>    <strong>curl_init</strong> — Initialize a cURL session</li>
<li>    <strong>curl_multi_add_handle</strong> — Add a normal cURL handle to a cURL multi handle</li>
<li>    <strong>curl_multi_close</strong> — Close a set of cURL handles</li>
<li>    <strong>curl_multi_exec</strong> — Run the sub-connections of the current cURL handle</li>
<li>    <strong>curl_multi_getcontent</strong> — Return the content of a cURL handle if CURLOPT_RETURNTRANSFER is set</li>
<li>    <strong>curl_multi_info_read</strong> — Get information about the current transfers</li>
<li>    <strong>curl_multi_init</strong> — Returns a new cURL multi handle</li>
<li><strong> curl_multi_remove_handle</strong> — Remove a multi handle from a set of cURL handles</li>
<li>    <strong>curl_multi_select</strong> — Wait for activity on any curl_multi connection</li>
<li>    <strong>curl_setopt_array</strong> — Set multiple options for a cURL transfer</li>
<li>    <strong>curl_setopt</strong> — Set an option for a cURL transfer</li>
<li>    <strong>curl_version </strong>— Gets cURL version information</li>
</ol>
<p><strong>curl_setopt </strong>is the pivot around which the main cURL functionality revolves. cURL functioning is controlled by way of passing predefined <a href="http://www.php.net/manual/en/function.curl-setopt.php" target="_blank">options</a> and values to this function.</p>
<h3>A simple example to handle google rss feed<br />
</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">/*
*
* Initialize the cURL session
*/</span>
<span style="color: #000088;">$curl_handler</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
*
* Set the URL of the page or file to download.
*/</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handler</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span>
<span style="color: #0000ff;">'http://news.google.com/news?hl=en&amp;topic=t&amp;output=rss'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
*
* Ask cURL to return the contents in a variable
* instead of simply echoing them to the browser.
*/</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handler</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
*
* Execute the cURL session,do some stuff with content
*/</span>
<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handler</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
*
* Close cURL session,
*be sure to close the handler as curl stores cookies ,other file data stores on server.
*/</span>
<span style="color: #990000;">curl_close</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handler</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In the above example we used CURLOPT_URL,CURLOPT_RETURNTRANSFER options.</p>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=448&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/php-curl-basic-reference/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php directory lister function</title>
		<link>http://www.maheshchari.com/php-directory-lister-function/</link>
		<comments>http://www.maheshchari.com/php-directory-lister-function/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 21:17:12 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=418</guid>
		<description><![CDATA[here is a simple function that iterates a directory recursively and returns as array.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
	function directory_map&#40;$source_dir, $top_level_only = FALSE&#41;
	&#123;	
		if &#40;$fp = @opendir&#40;$source_dir&#41;&#41;
		&#123;	
		//DIRECTORY_SEPARATOR is a constant is different on different Server OS
			$source_dir = rtrim&#40;$source_dir, DIRECTORY_SEPARATOR&#41;.DIRECTORY_SEPARATOR;		
			$filedata = array&#40;&#41;; //let grab all files n directorys into this array
			//readdire iterates all the files n folders and returns 
			while &#40;FALSE !== [...]]]></description>
			<content:encoded><![CDATA[<p>here is a simple function that iterates a directory recursively and returns as array.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> directory_map<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source_dir</span><span style="color: #339933;">,</span> <span style="color: #000088;">$top_level_only</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>	
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source_dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>	
		<span style="color: #666666; font-style: italic;">//DIRECTORY_SEPARATOR is a constant is different on different Server OS</span>
			<span style="color: #000088;">$source_dir</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source_dir</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #339933;">;</span>		
			<span style="color: #000088;">$filedata</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//let grab all files n directorys into this array</span>
			<span style="color: #666666; font-style: italic;">//readdire iterates all the files n folders and returns </span>
			<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">!==</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strncmp</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//if file or dir name is only '.' ,hidden files we skip them </span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$top_level_only</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">@</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source_dir</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$temp_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #666666; font-style: italic;">//if is directory call this function itself recursively</span>
					<span style="color: #000088;">$temp_array</span> <span style="color: #339933;">=</span> directory_map<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source_dir</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">.</span><span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #000088;">$filedata</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp_array</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #b1b100;">else</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$filedata</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//finally close the directory and unlock file or directory data</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$filedata</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//return as array</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// __FILE__ is PHP constant that tells the present executing script</span>
<span style="color: #666666; font-style: italic;">// dirname extracts the directory name from a given file contains</span>
<span style="color: #000088;">$present_directory_with_allfilesandfolder</span><span style="color: #339933;">=</span>directory_map<span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$onlyonetopleveldata</span><span style="color: #339933;">=</span>directory_map<span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3><a href='http://www.maheshchari.com/wp-content/uploads/2010/02/phpdirectoryiteration.zip'>Download Demo</a></h3>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=418&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/php-directory-lister-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php bytes conversion</title>
		<link>http://www.maheshchari.com/php-bytes-conversion/</link>
		<comments>http://www.maheshchari.com/php-bytes-conversion/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 12:45:58 +0000</pubDate>
		<dc:creator>mahesh chari</dc:creator>
				<category><![CDATA[PHP/mysql]]></category>

		<guid isPermaLink="false">http://www.maheshchari.com/?p=416</guid>
		<description><![CDATA[PHP byte conversion function
Generelly we need to display the file size in file sharing applications. Here we use below function to display the size in bytes with filesize function.

function byte_convert&#40;$bytes&#41;
  &#123;
    $symbol = array&#40;'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'&#41;;
&#160;
    $exp = 0;
    [...]]]></description>
			<content:encoded><![CDATA[<h1>PHP byte conversion function</h1>
<p>Generelly we need to display the file size in file sharing applications. Here we use below function to display the size in bytes with <strong>filesize</strong> function.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> byte_convert<span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$symbol</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'B'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'KB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'GB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'TB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'PB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'EB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ZB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'YB'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$exp</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$converted_value</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$bytes</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$exp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$converted_value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$bytes</span><span style="color: #339933;">/</span><span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1024</span><span style="color: #339933;">,</span><span style="color: #990000;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$exp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%.2f '</span><span style="color: #339933;">.</span><span style="color: #000088;">$symbol</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$exp</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$converted_value</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//we can't use PHP integer unsigned as some systems use 32 bit and other 64 bit ,so here we use C style function sprintf</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<h2>File size stadards </h2>
<p>computer data and file size is normally  measured in binary code using the binary number system, the prefixes for  the multiples are based on the metric system!  The nearest binary  number to 1,000 is 2^10 or 1,024; thus 1,024 bytes was named a  Kilobyte. </p>
<table cellspacing="1" cellpadding="2" border="0">
<tbody>
<tr  align="center">
<td colspan="3"><strong>New IEC Standard </strong></td>
</tr>
<tr >
<td align="left">bit</td>
<td>bit</td>
<td align="left">0 or 1</td>
</tr>
<tr >
<td align="left">byte</td>
<td>B</td>
<td align="left">8 bits</td>
</tr>
<tr >
<td align="left">kibibit</td>
<td>Kibit</td>
<td align="left">1024 bits</td>
</tr>
<tr >
<td align="left">kilobit</td>
<td>kbit</td>
<td align="left">1000 bits</td>
</tr>
<tr >
<td align="left">kibibyte (binary)</td>
<td>KiB</td>
<td align="left">1024 bytes</td>
</tr>
<tr >
<td align="left">kilobyte (decimal)</td>
<td>kB</td>
<td align="left">1000 bytes</td>
</tr>
<tr >
<td align="left">megabit</td>
<td>Mbit</td>
<td align="left">1000 kilobits</td>
</tr>
<tr >
<td align="left">mebibyte (binary)</td>
<td>MiB</td>
<td align="left">1024 kibibytes</td>
</tr>
<tr >
<td align="left">megabyte (decimal)</td>
<td>MB</td>
<td align="left">1000 kilobytes</td>
</tr>
<tr >
<td align="left">gigabit</td>
<td>Gbit</td>
<td align="left">1000 megabits</td>
</tr>
<tr >
<td align="left">gibibyte (binary)</td>
<td>GiB</td>
<td align="left">1024 mebibytes</td>
</tr>
<tr >
<td align="left">gigabyte (decimal)</td>
<td>GB</td>
<td align="left">1000 megabytes</td>
</tr>
<tr >
<td align="left">terabit</td>
<td>Tbit</td>
<td align="left">1000 gigabits</td>
</tr>
<tr >
<td align="left">tebibyte (binary)</td>
<td>TiB</td>
<td align="left">1024 gibibytes</td>
</tr>
<tr >
<td align="left">terabyte (decimal)</td>
<td>TB</td>
<td align="left">1000 gigabytes</td>
</tr>
<tr >
<td align="left">petabit</td>
<td>Pbit</td>
<td align="left">1000 terabits</td>
</tr>
<tr >
<td align="left">pebibyte (binary)</td>
<td>PiB</td>
<td align="left">1024 tebibytes</td>
</tr>
<tr >
<td align="left">petabyte (decimal)</td>
<td>PB</td>
<td align="left">1000 terabytes</td>
</tr>
<tr >
<td align="left">exabit</td>
<td>Ebit</td>
<td align="left">1000 petabits</td>
</tr>
<tr >
<td align="left">exbibyte (binary)</td>
<td>EiB</td>
<td align="left">1024 pebibytes</td>
</tr>
<tr >
<td align="left">exabyte (decimal)</td>
<td>EB</td>
<td align="left">1000 petabytes</td>
</tr>
</tbody>
</table>
<img src="http://www.maheshchari.com/?ak_action=api_record_view&id=416&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.maheshchari.com/php-bytes-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
