<?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>SpaLinux.com - สปาลีนุกซ์ &#187; Programming</title>
	<atom:link href="http://spalinux.com/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>เพื่อชีวิตที่ผ่อนคลายของคนใช้ลีนุกซ์</description>
	<lastBuildDate>Sat, 12 May 2012 10:38:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>การเขียนโปรแกรม PHP เพื่อสร้าง barcode</title>
		<link>http://spalinux.com/2008/06/writing_php_to_create_barcode_image</link>
		<comments>http://spalinux.com/2008/06/writing_php_to_create_barcode_image#comments</comments>
		<pubDate>Mon, 30 Jun 2008 15:24:02 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[barcode]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=47</guid>
		<description><![CDATA[บทความนี้ขอกล่าวถึงการเขียนโปรแกรม PHP เพื่อสร้าง barcode ในรูปภาพในแบบต่างๆ ได้ ดาวน์โหลดและติดตั้ง PEAR Package :: Image_Barcode เริ่มต้นเราต้องดาวน์โหลด Image_Barcode มาติดตั้งก่อน โดยสามารถดูลิ้งค์ดาวน์โหลดได้ที่ ข้อมูลอ้างอิง ด้านล่างของบทความนี้ เนื่องจากเป็น PEAR Package ต้องติดตั้งไฟล์ที่ดาวน์โหลดมาเข้าไปใน /usr/share/pear/ ตัวอย่างการติดตั้ง Image_Barcode [root@server ~]#  tar zxvf Image_Barcode-1.1.0.tgz package.xml Image_Barcode-1.1.0/Barcode/Code39.php Image_Barcode-1.1.0/Barcode/code128.php Image_Barcode-1.1.0/Barcode/ean13.php Image_Barcode-1.1.0/Barcode/int25.php Image_Barcode-1.1.0/Barcode/postnet.php Image_Barcode-1.1.0/Barcode/upca.php Image_Barcode-1.1.0/docs/examples/barcode_img.php Image_Barcode-1.1.0/docs/examples/test-image-barcode.php Image_Barcode-1.1.0/docs/ChangeLog Image_Barcode-1.1.0/docs/Readme.txt Image_Barcode-1.1.0/Barcode.php [root@server ~]# cd Image_Barcode-1.1.0 [root@server Image_Barcode-1.1.0]# ls –l total 12 drwxr-xr-x 2 root root [...]]]></description>
			<content:encoded><![CDATA[<p>บทความนี้ขอกล่าวถึงการเขียนโปรแกรม PHP เพื่อสร้าง barcode ในรูปภาพในแบบต่างๆ ได้</p>
<p><span id="more-47"></span></p>
<p><strong>ดาวน์โหลดและติดตั้ง PEAR Package :: Image_Barcode</strong><br />
เริ่มต้นเราต้องดาวน์โหลด Image_Barcode มาติดตั้งก่อน โดยสามารถดูลิ้งค์ดาวน์โหลดได้ที่ ข้อมูลอ้างอิง ด้านล่างของบทความนี้<br />
เนื่องจากเป็น PEAR Package ต้องติดตั้งไฟล์ที่ดาวน์โหลดมาเข้าไปใน /usr/share/pear/</p>
<p><strong>ตัวอย่างการติดตั้ง Image_Barcode</strong></p>
<pre>[root@server ~]#  <strong>tar zxvf Image_Barcode-1.1.0.tgz
</strong>package.xml
Image_Barcode-1.1.0/Barcode/Code39.php
Image_Barcode-1.1.0/Barcode/code128.php
Image_Barcode-1.1.0/Barcode/ean13.php
Image_Barcode-1.1.0/Barcode/int25.php
Image_Barcode-1.1.0/Barcode/postnet.php
Image_Barcode-1.1.0/Barcode/upca.php
Image_Barcode-1.1.0/docs/examples/barcode_img.php
Image_Barcode-1.1.0/docs/examples/test-image-barcode.php
Image_Barcode-1.1.0/docs/ChangeLog
Image_Barcode-1.1.0/docs/Readme.txt
Image_Barcode-1.1.0/Barcode.php
[root@server ~]# cd Image_Barcode-1.1.0
[root@server Image_Barcode-1.1.0]# <strong>ls –l
</strong>total 12
drwxr-xr-x 2 root root 4096 2008-06-30 22:01 Barcode
-rw-r--r-- 1 1000 1000 3727 2007-02-28 21:31 Barcode.php
drwxr-xr-x 3 root root 4096 2008-06-30 22:01 docs
[root@server Image_Barcode-1.1.0]#<strong> chown –R root.root .
</strong>[root@server Image_Barcode-1.1.0]# <strong>cp -av Barcode/ Barcode.php /usr/share/pear/Image/
</strong>`Barcode/' -&gt; `/usr/share/pear/Image/Barcode'
`Barcode/Code39.php' -&gt; `/usr/share/pear/Image/Barcode/Code39.php'
`Barcode/int25.php' -&gt; `/usr/share/pear/Image/Barcode/int25.php'
`Barcode/code128.php' -&gt; `/usr/share/pear/Image/Barcode/code128.php'
`Barcode/ean13.php' -&gt; `/usr/share/pear/Image/Barcode/ean13.php'
`Barcode/upca.php' -&gt; `/usr/share/pear/Image/Barcode/upca.php'
`Barcode/postnet.php' -&gt; `/usr/share/pear/Image/Barcode/postnet.php'
`Barcode.php' -&gt; `/usr/share/pear/Image/Barcode.php'
[root@server Image_Barcode-1.1.0]#<strong> ls -l /usr/share/pear/Image/
</strong>total 96
drwxr-xr-x  2 root root  4096 2008-06-30 22:01 Barcode
-rw-r--r--  1 root root  3727 2007-02-28 21:31 Barcode.php
drwxr-xr-x  4 root root  4096 2008-05-14 13:35 Canvas
-rw-r--r--  1 root root 21035 2007-07-03 06:20 Canvas.php
-rw-r--r--  1 root root 27180 2007-01-15 03:36 Color.php
drwxr-xr-x 15 root root  4096 2008-05-27 17:58 Graph
-rw-r--r--  1 root root 27717 2007-03-14 06:26 Graph.php</pre>
<p><strong>ทดสอบเขียนโปรแกรมทดสอบการสร้าง Barcode<br />
</strong>ด้านล่างจะเป็นตัวอย่างโปรแกรมที่ใช้สร้าง barcode จากตัวเลขที่ระบุ เป็นชนิด ean13 และ barcode ที่สร้างได้จะเป็นรูปภาพแบบ png</p>
<pre>&lt;?php</pre>
<pre>require_once('Image/Barcode.php');</pre>
<pre>$barcode_type = 'ean13';
$barcode_img  = 'png';
$barcode_text = '0123456789012';</pre>
<pre>Image_Barcode::draw($barcode_text, $barcode_type, $barcode_img);</pre>
<pre>?&gt;</pre>
<p>ตัวอย่าง barcode ที่สร้างได้จากโปรแกรมด้านบน</p>
<p><a href="http://spalinux.com/wp-content/uploads/2008/06/barcode_0123456789012.png"><img class="alignnone size-medium wp-image-48" title="barcode_0123456789012" src="http://spalinux.com/wp-content/uploads/2008/06/barcode_0123456789012.png" alt="" width="109" height="70" /></a></p>
<p>ถ้าต้องการสร้าง barcode ในรูปแบบอื่นๆ สามารถเปลี่ยนค่าตัวแปร $barcode_type  ได้ โดยสามารถดูรูปแบบ barcode ชนิดต่างๆ ในส่วนข้อมูลอ้างอิงได้</p>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a href="http://pear.php.net/package/Image_Barcode" target="_blank">PEAR :: Package :: Image_Barcode</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/06/writing_php_to_create_barcode_image/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>เขียนโปรแกรม PHP เพื่อส่งเมล์ผ่าน gmail</title>
		<link>http://spalinux.com/2008/05/php_sending_email_gmail</link>
		<comments>http://spalinux.com/2008/05/php_sending_email_gmail#comments</comments>
		<pubDate>Wed, 21 May 2008 09:37:30 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=22</guid>
		<description><![CDATA[ขอแวบมาเขียนบทความเกี่ยวกับการเขียนโปรแกรมซะหน่อย หลังจากเขียนสำหรับผู้ดูแลระบบมาหลายบทความแล้ว บทความนี้ขอกล่าวถึงการเขียนโปรแกรม PHP เพื่อส่งอีเมล์ผ่านบริการ SMTP ของ gmail โดยเราจะอาศัย class library ที่ชื่อ PHPMailer เพื่อให้สามารถใช้ SSL SMTP ของ gmail ได้ ดาวน์โหลดและติดตั้ง PHPMailer เริ่มต้นเราต้องดาวน์โหลด PHPMailer มาติดตั้งก่อน โดยสามารถดูลิ้งค์ดาวน์โหลดได้ที่ ข้อมูลอ้างอิง ด้านล่างของบทความนี้ ไฟล์ที่เราได้มาจากการดาวน์โหลดจะมีหลายไฟล์ ทั้งไฟล์ class ตัวอย่างการใช้งาน เอกสารต่างๆ ไฟล์ที่จำเป็นจริงๆ จะมี 3 ไฟล์คือ class.phpmailer.php class.pop3.php class.smtp.php เขียนโปรแกรมทดสอบการส่งอีเมล์ ด้านล่างจะเป็นตัวอย่างโปรแกรมที่ใช้ส่งอีเมล์ โดยเราต้องแก้ค่าตัวแปรต่างๆ เช่น Username, Password,&#8230; ของ gmail ที่ใช้ &#60;?php require(&#8220;class.phpmailer.php&#8221;); require(&#8220;class.smtp.php&#8221;); $mail=new PHPMailer(); $mail-&#62;IsSMTP(); $mail-&#62;IsHTML(true); [...]]]></description>
			<content:encoded><![CDATA[<p>ขอแวบมาเขียนบทความเกี่ยวกับการเขียนโปรแกรมซะหน่อย หลังจากเขียนสำหรับผู้ดูแลระบบมาหลายบทความแล้ว</p>
<p>บทความนี้ขอกล่าวถึงการเขียนโปรแกรม PHP เพื่อส่งอีเมล์ผ่านบริการ SMTP ของ gmail โดยเราจะอาศัย class library ที่ชื่อ PHPMailer เพื่อให้สามารถใช้ SSL SMTP ของ gmail ได้</p>
<p><span id="more-22"></span></p>
<p><strong>ดาวน์โหลดและติดตั้ง PHPMailer</strong><br />
เริ่มต้นเราต้องดาวน์โหลด PHPMailer มาติดตั้งก่อน โดยสามารถดูลิ้งค์ดาวน์โหลดได้ที่ ข้อมูลอ้างอิง ด้านล่างของบทความนี้</p>
<p>ไฟล์ที่เราได้มาจากการดาวน์โหลดจะมีหลายไฟล์ ทั้งไฟล์ class ตัวอย่างการใช้งาน เอกสารต่างๆ ไฟล์ที่จำเป็นจริงๆ จะมี 3 ไฟล์คือ class.phpmailer.php class.pop3.php class.smtp.php</p>
<p><strong>เขียนโปรแกรมทดสอบการส่งอีเมล์</strong><br />
ด้านล่างจะเป็นตัวอย่างโปรแกรมที่ใช้ส่งอีเมล์ โดยเราต้องแก้ค่าตัวแปรต่างๆ เช่น Username, Password,&#8230; ของ gmail ที่ใช้</p>
<p><code>&lt;?php</code></p>
<p>require(&#8220;class.phpmailer.php&#8221;);<br />
require(&#8220;class.smtp.php&#8221;);</p>
<p>$mail=new PHPMailer();</p>
<p>$mail-&gt;IsSMTP();<br />
$mail-&gt;IsHTML(true);</p>
<p>$mail-&gt;SMTPAuth = true;<br />
$mail-&gt;SMTPSecure = &#8220;ssl&#8221;;<br />
$mail-&gt;Host = &#8220;smtp.gmail.com&#8221;;<br />
$mail-&gt;Port = 465;</p>
<p>$mail-&gt;Username = &#8220;<strong>username@gmail.com</strong>&#8220;;<br />
$mail-&gt;Password = &#8220;<strong>password</strong>&#8220;;</p>
<p>$mail-&gt;From = &#8220;<strong>username@gmail.com</strong>&#8220;;<br />
$mail-&gt;FromName = &#8220;<strong>Sender Name</strong>&#8220;;<br />
$mail-&gt;Subject = &#8220;<strong>This is a testing subject from gmail</strong>&#8220;;<br />
$mail-&gt;Body = &#8220;<strong>Hi,This is testing &lt;b&gt;HTML&lt;/b&gt; message</strong>.&#8221;;</p>
<p>$mail-&gt;AddAddress(&#8220;<strong>your-friend@domain.com</strong>&#8220;,&#8221;<strong>your-friend@domain.com</strong>&#8220;);<br />
if(!$mail-&gt;Send()) {<br />
echo &#8220;Mailer Error: &#8221; . $mail-&gt;ErrorInfo;<br />
} else {<br />
echo &#8220;Message has been sent&#8221;;<br />
}<br />
?&gt;</p>
<p>เมื่อแก้ไขไฟล์เรียบร้อย จะรันผ่านเว็บหรือเป็นแบบคอมมานด์ก็ได้ ลองดูครับ</p>
<p><strong>ข้อมูลอ้างอิง</strong></p>
<ul>
<li><a href="http://phpmailer.codeworxtech.com/" target="_blank">PHPMailer Official Site</a></li>
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=26031" target="_blank">Download PHPMailer</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2008/05/php_sending_email_gmail/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

