<?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>Kristou Says &#187; PHP</title>
	<atom:link href="http://mehrez.kristou.org/category/computer/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://mehrez.kristou.org</link>
	<description>I share my experience</description>
	<lastBuildDate>Wed, 29 Jun 2011 19:25:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>PHP: Gmail with RoundCube</title>
		<link>http://mehrez.kristou.org/php-gmail-with-roundcube/</link>
		<comments>http://mehrez.kristou.org/php-gmail-with-roundcube/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 06:02:16 +0000</pubDate>
		<dc:creator>Kristou Mehrez</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kristou.com/index.php/2009/08/12/php-gmail-with-roundcube/</guid>
		<description><![CDATA[Some times I have problem accessing Gmail because of some Firewall restrictions. Or I would like to have my own WebMail client for my mail service hosted with Google Apps. I tried several setting and I found out that it is not that difficult just you have to know the right parameters. Here are the [...]]]></description>
			<content:encoded><![CDATA[<p>Some times I have problem accessing Gmail because of some Firewall restrictions. Or I would like to have my own WebMail client for my mail service hosted with Google Apps. I tried several setting and I found out that it is not that difficult just you have to know the right parameters.</p>
<p>Here are the parameters that worked for me:<br />
In your main.inc.php try to modify these setting:</p>
<pre class="brush:php">
// IMAP settings
$rcmail_config['default_host'] = 'ssl://imap.gmail.com:993';
$rcmail_config['default_port'] = 993;
$rcmail_config['imap_auth_type'] = null;

$rcmail_config['username_domain'] = 'gmail.com';
$rcmail_config['mail_domain'] = 'gmail.com';

//SMTP settings
$rcmail_config['smtp_server'] = 'ssl://smtp.gmail.com';
$rcmail_config['smtp_port'] = 465;
$rcmail_config['smtp_user'] = '%u';
$rcmail_config['smtp_pass'] = '%p';

//MBox settings
$rcmail_config['drafts_mbox'] = '[Gmail]/Drafts';
$rcmail_config['junk_mbox'] = '[Gmail]/Spam';
$rcmail_config['sent_mbox'] = '';
$rcmail_config['trash_mbox'] = '';
$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
</pre>
<p>[ad#AdBrite inline]</p>
<p>If you want to try. I made this setting on my sub domain <a href="http://mygmail.kristou.com">mygmail.kristou.com</a>. It is a RoudCube with the above settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://mehrez.kristou.org/php-gmail-with-roundcube/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: Write to ini file array containing array</title>
		<link>http://mehrez.kristou.org/php-write-to-ini-file-array-containing-array/</link>
		<comments>http://mehrez.kristou.org/php-write-to-ini-file-array-containing-array/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 16:27:55 +0000</pubDate>
		<dc:creator>Kristou Mehrez</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kristou.com/?p=179</guid>
		<description><![CDATA[public function write_ini_file($data, $path, $mode) { foreach ($data as $key => $item) { if (is_array($item)) { $content .= "\n\n"; } } } else { $content .= "$key = \"$item\"\n";]]></description>
			<content:encoded><![CDATA[<pre class="brush:php">
public function write_ini_file($data, $path, $mode) {

		foreach ($data as $key => $item) {
			if (is_array($item)) {
				$content .= "\n[$key]\n";
				foreach ($item as $key2 => $item2) {
					if(is_array($item2)){
						foreach ($item2 as $key3 => $item3) {
							$content .= $key2."[] = \"".$item3."\"\n";
						}
					} else {
						$content .= "$key2 = \"$item2\"\n";
					}
				}
			} else {
				$content .= "$key = \"$item\"\n";
			}
		}

		if (!$handle = fopen($path, $mode)) {
			return false;
		}

		if (!fwrite($handle, $content)) {
			return false;
		}

		fclose($handle);
		return true;
	} // end write_ini_file()
</pre>
<p>[ad#AdBrite inline]</p>
]]></content:encoded>
			<wfw:commentRss>http://mehrez.kristou.org/php-write-to-ini-file-array-containing-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Append content to file</title>
		<link>http://mehrez.kristou.org/php-append-content-to-file/</link>
		<comments>http://mehrez.kristou.org/php-append-content-to-file/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 05:06:01 +0000</pubDate>
		<dc:creator>Kristou Mehrez</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kristou.com/?p=127</guid>
		<description><![CDATA[$myFile = "testFile.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "New Stuff 1\n"; fwrite($fh, $stringData); $stringData = "New Stuff 2\n"; fwrite($fh, $stringData); fclose($fh);]]></description>
			<content:encoded><![CDATA[<pre class="brush:php">
$myFile = "testFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "New Stuff 1\n";
fwrite($fh, $stringData);
$stringData = "New Stuff 2\n";
fwrite($fh, $stringData);
fclose($fh);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mehrez.kristou.org/php-append-content-to-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: String token for string split</title>
		<link>http://mehrez.kristou.org/php-string-token-for-string-split/</link>
		<comments>http://mehrez.kristou.org/php-string-token-for-string-split/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 04:30:30 +0000</pubDate>
		<dc:creator>Kristou Mehrez</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kristou.com/?p=124</guid>
		<description><![CDATA[$token = strtok($string,","); $token = strtok(",");]]></description>
			<content:encoded><![CDATA[<pre class="brush:php">
< ?
$token = strtok($string,",");
while($token){
  print($token . "");
  $token = strtok(",");
}
?>
</pre>
<p>[ad#AdBrite inline]</p>
]]></content:encoded>
			<wfw:commentRss>http://mehrez.kristou.org/php-string-token-for-string-split/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Find string between 2 strings</title>
		<link>http://mehrez.kristou.org/php-find-string-between-2-strings/</link>
		<comments>http://mehrez.kristou.org/php-find-string-between-2-strings/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 00:28:53 +0000</pubDate>
		<dc:creator>Kristou Mehrez</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kristou.com/?p=109</guid>
		<description><![CDATA[While looking in the Internet for a good function to strip a string, I found this blog where this function is implemented. function get_string_between($string, $start, $end){ $string = " ".$string; $len = strpos($string,$end,$ini) - $ini;]]></description>
			<content:encoded><![CDATA[<p>While looking in the Internet for a good function to strip a string, I found this <a href="http://www.justin-cook.com/wp/2006/03/31/php-parse-a-string-between-two-strings/">blog</a> where this function is implemented.<br />
[code brush="php"] function get_string_between($string, $start, $end){<br />
$string = " ".$string;<br />
$ini = strpos($string,$start);<br />
if ($ini == 0) return "";<br />
$ini += strlen($start);<br />
$len = strpos($string,$end,$ini) - $ini;<br />
return substr($string,$ini,$len);<br />
}</p>
<p>$fullstring = "this is my [tag]dog[/tag]";<br />
$parsed = get_string_between($fullstring, "[tag]", "[/tag]");<br />
echo $parsed; // (result = dog)<br />
[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://mehrez.kristou.org/php-find-string-between-2-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

