Using pear xml_rss to parse an RSS feed

RSS feeds can easily be parsed using the PHP server-side scripting language. All that is needed is Pear Library called XML_RSS. The following code shows how to parse an RSS feed, and print the contents out to a web page:

<?php
/*
* Created on Aug 29, 2005 
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
 
require_once "XML/RSS.php";
 
if(ini_get("allow_url_fopen") == 0){
    echo "setting allow_url_fopen = On
";
    ini_set("allow_url_fopen",1);
}
 
$php_url = "http://news.php.net/group.?group=php.announce";
$rss =& new XML_RSS($php_url."&format=rss");
$rss->parse();
print "<h1>Headlines from <a href=\"".$php_url."\">PHP Announce</a></h1>\n";
 
$rssitems = $rss->getItems();
$rssitems = array_reverse($rssitems);
$j = count($rssitems);
 
print "<ul>\n";
for($i=0; $i<$j; $i++){
    echo "<li>";
    echo "<a href=\"".$rssitems[$i]['link']."\">".$rssitems[$i]['title']."</a>";
    echo "</li>\n";
}
echo "</ul>\n";
?>
 

Using PHP with Oracle InstantClient on Win32

PHP 5 now supports a new OCI8 client installation called, oci8-instant-client. This option was added to the PHP 5 source as of version 5.0.4. Oracle Corp. came out with a new means of installing Oracle Client software, called Oracle Instantclient. This lighter weight client has a small installation footprint, and includes the bare minimum in executables, and libraries that are needed to establish connections to Oracle. The Oracle Instantclient is broken up into the following classes:

Read more ...

Using PHP with Oracle InstantClient on Solaris

The purpose of this article is to discuss some of the uses and applications for using the new Oracle Instantclient software to connect with multiple disparate Oracle databases that run at different release levels, including Oracle 8i, Oracle 9i, and 10g. The document focuses on the steps for compiling PHP 5.0.5 with oci-instant-client support on the Solaris operating system. This article assumes that you already have a functioning web server like Apache 2.

Read more ...

PHP and Javascript checkbox conflict

There is a potential conflict between the server-side and client-side processing of checkbox form elements in PHP (server-side) and JavaScript (client-side). The problem is caused by the name of the checkbox element as it is written in the PHP script. PHP expects a checkbox group to be named "mycheckbox[]" so that it will store and return an array to PHP for processing. Javascript will not be able to access this form element in the traditional manner. See the code examples below to see what the problem is and how it is solved.

Read more ...

Eclipse 3.2 module update

I've been working in Eclipse for several years now and have grown fond of a few noteworthy plug-ins.  While my background is in network engineering, the last several years, I have bolstered those skills with development skills in PHP, Perl, Java, and Python.  The following modules are now part of my standard Eclipse configuration:

  • Eclipse WST project tool set - this is the Web Standard Tools project that is right out of the Eclipse site.  It seems a lot of the web-based projects are based off of this initial workbench.  I did try MyEclipse, but found that to be a bit too JSP-centric for my needs.  The WST seems to offer a good solid basic workbench for editing HTML, CSS, and JS files. 

    Location: http://download.eclipse.org/webtools/downloads/

  • EPIC Perl - This appears to be the best and only solution for editing Perl code in Eclipse.  I have been using this for years, and have found it to meet all my needs.  I have used the testing Update site code and have found it to be more than stable enough for my needs.

    Location:
    http://e-p-i-c.sf.net/updates (stable)
    Location: http://e-p-i-c.sf.net/updates/testing (testing)

  • PHPEclipse - For the longest time i have watched this project and used its code.  Its pretty solid, but I must say, there has been a lengthy delay in recent releases.  The sourceforge project page indicates a lot of activity, but i haven't seen much in the way of new releases for quite some time.  So, i have decided to try the relatively new PDT workbench.  This module is available from Sourceforge.

    Location: http://sourceforge.net/projects/phpeclipse/
     
  • Eclipse PDT - This seems like it will be pretty slick.  Its early in the development cycle, but there is a lot of activity.  Installation worked just fine, and I am really just getting started with it.  I had problems with applying this Nature to an existing project that i had developed in PHPEclipse.  The problem was that none of the code completion or Outline functions would work.  I found a way to "cleanse" my PHPEclipse code and now i am off to the races.  I will comment on this more in the future when i have some time under my belt.

    Location: http://download.eclipse.org/tools/pdt/downloads/

  • JSEclipse - This is a new workbench for me, so i don't have any experience with it yet also.  It is for Javascript Editing.  This project was formerly run by Interakt, but was bought by Adobe.  You can still get it free, but need an account login at Adobe Labs.  They are currently on 1.5.5 of this software and a new beta 2.0 is also available.  Supposedly this module has code-completion for Prototype and Script.aculo.us.  I am very interested in how this module works with WTP Javascript editing and PHP.  Initial impressions were that it was going to be much better, b/c it had the ability to "see" the javascript inside PHP files.  More on this later.

    Location: http://labs.adobe.com/technologies/jseclipse/

  • Vi Plugin - This module is just handy. Period! I get it from www.satokar.com.  I reccommend purchasing the license and using this with all of the above.  It makes life so easy.

Configuring Dovecot IMAP server w/ SSL on Linux

The purpoase of this article is to document the steps taken to enable the Dovecot IMAP server with SSL. For the purposes of this article, we will act as a CA or Certificate Authority. We will self-sign the SSL private and public keys for this task. It is assumed that both Dovecot and SSL are installed on the system in question.

First, create a CA subdirectory in /etc. This will be where we will copy the self-signed sertificate files. Dovecot needs PEM-encoded keys for this. To create the keys issue the following command from the /etc/CA directory:

openssl req -x509 -nodes -days 3650 \
 -subj '/C=US/ST=NC/L=Denver/O=Acme Corporation/CN=somehost.acme.com' \
 -newkey rsa:1024 -keyout key.pem -out cert.pem

Two files are generated, one is the public key and the other is the private key. cert.pem is the public certificate that will later be shared and installed in various email clients. The key.pem is the private key and should be protected. In fact, both files should be protected. Dovecot is started by the root user and these files will be read while the user root still is involved in starting dovecot. To protect my files, I issued the following command:

[#/etc] chmod -R 600 CA

This command set the permissions to readonly for the user root on the entire /etc/CA directory and its contents.

Next, I made a copy of cert.pem and copied this file to my laptop that was running a copy of Outlook. You could also do the same thing for Outlook Express and other IMAP-based email clients. I will provide the steps for installing the public key or certificate into Windows to work with Outlook. To install the public key into the root certificate store, I renamed the file from cert.pem to deovecot.crt. Then you can double-click on the file in Explorer or you can "execute" the file from a DOS box. Follow the prompts and ignore the alerts, but make sure that you install them into the Root Certificate Store.

Ensure that the following is set in the /etc/dovcot.conf:

ssl_disable = no
ssl_cert_file = /etc/CA/cert.pem
ssl_key_file = /etc/CA/key.pem

Restart the dovecot server by issuing the /etc/init.d/dovecot restart

Once the server has restarted, check to make sure that no errors occured. Then close and re-open Outlook. You should no longer receive those anoying pop-up security notifications about certificates.