libcurlemu – a pure PHP curl implementation (libcurl emulator)

Have you came across a situation where you need to use php libcurl extension and it was not enabled on your webserver? Then, try libcurlemu, apure-PHP implementation to PHP cURL. It emulates all of the curl_* functions normally provided by the native cURL extension itself.

libcurlemu works transparently regardless of the availability of PHP cURL extensions, thus making your script even more portable across web server that does not have PHP cURL extensions.

What is libcurl / cURL?

cURL is a command-line tool that supports transfering files with URL syntax. It supports many protocols like FTP, FTPS, TFTP, HTTP, HTTPS, TELNET, DICT, FILE and LDAP.

libcurl is a library based on cURL that helps you to connect and communicate with different type of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, and ldap protocols.

For HTTP/HTTPS protocol, libcurl supports POST, PUT, GET and DELETE method, making it suitable for writing web services, particularly REST-like services.

Stay tune for code examples on how to use libcurl to emulate a browser submitting POST request to a server.

libcurlemu is written by Steve Blinch, and can be downloaded at his website : http://code.blitzaffe.com

php, libcurl, curl, rest, opensource

Using Feedcreator to generate ATOM 1.0 feeds

I’m going give out a tip on using feedcreator class library to ease up generating syndication feeds for your web project. As you might know, there are different kind of syndication format out there such as RSS 2.0, RSS 1.0, RSS0.91, ATOM0.3 and ATOM1.0. Each of the syndication format has its own markup (though RSS 0.91 and 2.0 are closely related), making generating feeds from scratch can be quite a chore for your project.

Feedcreator provides an easy way to create RSS and ATOM feeds from within PHP using ease to use classes. However, feedcreator has a couple of drawback :

  1. It does not support ATOM 1.0
  2. Doesn’t support Enclosure
  3. Can’t generate feeds on the fly

Though these drawbacks might not be as serious as I put in here, it is nice to have this features implemented on feedcreator. ATOM 1.0 is a new syndication format issued by IETF as a standard way to produce feeds, ATOM 1.0 has a nice features and more structured layout than the ever-inconsistent RSS feeds.

Though Enclosure tag is optional in RSS 2.0, the tag is significant for those who are into podcasting or photoblogging. Enclosure feature allows for the syndicated feed to not just serve text content, but also to package an enclosure (call it an attachment of some sort), as well. IIn the podcasting model, the RSS enclosure contains an audio file, which subscribers can listen to on their devices.

Generating feeds on the fly is one of the most requested feature of feedcreator. This allows feeds to be generated dynamically upon request as opposed to generating feed on certain event (such as posting new articles). Mambo and PhpGedView project uses modified Feedcreator to generate feeds on-the-fly.

I’ve published a modified version of Feedcreator (namely Feedcreator 1.7.2-ppt) that contains all of these enhancements (or hacks). Here’s a snippets on how to use the additional features :


/*

This demo is to illustrate how to use feedcreator
using outputFeed function, ATOM1.0 and enclosure
support.

Enclosure support is useful if you are into
podcasting or publishing photoblog.

the required parameter for enclosure is url, length
and type (as in MIME-type)

*/

< ? php include ("include/feedcreator.class.php"); //define channel $rss = new UniversalFeedCreator(); $rss->useCached();
$rss->title="Personal News Site";
$rss->description="daily news from me";
$rss->link="http://mydomain.net/";
$rss->syndicationURL="http://mydomain.net/$PHP_SELF";

//channel items/entries
$item = new FeedItem();
$item->title = "test berita pertama";
$item->link = "http://mydomain.net/news/somelinks.html";
$item->description = "hahaha aku berjaya!";
$item->source = "http://mydomain.net";
$item->author = "my_email@mydomain.net";

//optional enclosure support
$item->enclosure = new EnclosureItem();
$item->enclosure->url='http://mydomain.net/news/picture.jpg';
$item->enclosure->length="65905";
$item->enclosure->type='image/jpeg';

$rss->addItem($item);

//Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
// MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS

$rss->outputFeed("ATOM1.0");
//$rss->saveFeed("ATOM1.0", "news/feed.xml");

?>

You can download the modified version of Feedcreator 1.7.2 from my server, the zip package contains the modified class library, GNU/LGPL license, some demo php file and a diff file against the plain vanilla Feedcreator 1.7.2 for curious people.

p/s : all of the modifications are written by me except outputFeed function which is written by Fabian Wolf.

Download :
Feedcreator 1.7.2-ppt (zip)

Feedcreator website : http://www.bitfolge.de/rsscreator-en.html

osCommRes – sell your services online

osCommRes is an e-commerce application that allow businesses sell services online. It differs from conventional e-commerce web application which sells tangible or digital products.

osCommRes instead allows you to sell your services, be it massage service, counselling, spa threatment, etc. osCommerce allows you to sell it all across the internet.

osCommRes key features is :

  1. Product/Events: Products and events can be purchased in the one transaction saving you and the customer time and money.
  2. Online customer payments: Customers can book in and purchase products online in the same transation.
  3. Website Template: If you have the skills in-house, you can modify the look and feel of the product to suit the design of your site.
  4. Online reservation: Allows customer to reserve your service

osCommRes is licensed under the GNU General Public License an was based heavily on the rock-solid oscommerce e-commerce web application.

[osCommRes project page]

Unix worm that exploits vulnerable PHP/CGI scripts

Please secure and patch your PHP scripts, especially the one that uses xml-rpc protocol. The Linux/Lupper.worm (a variant of BSD/Scalper) might infect your system.

This worm spreads by exploiting specific PHP/CGI script vulnerabilities that could be hosted on the following URLs:

….
# http://[website]/stats/
# http://[website]/xmlrpc.php
# http://[website]/xmlrpc/xmlrpc.php
# http://[website]/xmlsrv/xmlrpc.php
# http://[website]/blog/xmlrpc.php
# http://[website]/drupal/xmlrpc.php
# http://[website]/community/xmlrpc.php
# http://[website]/blogs/xmlrpc.php
# http://[website]/blogs/xmlsrv/xmlrpc.php
# http://[website]/blog/xmlsrv/xmlrpc.php
# http://[website]/blogtest/xmlsrv/xmlrpc.php
# http://[website]/b2/xmlsrv/xmlrpc.php
# http://[website]/b2evo/xmlsrv/xmlrpc.php
# http://[website]/wordpress/xmlrpc.php
# http://[website]/phpgroupware/xmlrpc.php

Source : McAfee virus information library

RSS 2.0 / Atom 1.0 for Coppermine 1.3.x plugin

Coppermine 1.3.x Plugin RSS 2.0

I’ve made some improvements over my previous Coppermine plugin.

I’ve added Atom 1.0 support and picture caption to the published feed. I’ve also altered the default feed to publish the latest 10 photos instead of 6.

Well, glad to have a plugin that can publish both RSS and Atom feed in Coppermine 1.3.x

old Download links :

  1. zip package
  2. tar.gz package

Download Coppermine RSS/ATOM plugin here:

  1. Mirror #1
  2. Mirror #2
  3. Mirror #3

*Note that this plugin worked under Coppermine 1.4.x also, but it is untested with PHP 5.x.

Installing Java 2 SDK on Debian GNU/Linux and Ubuntu

Java Logo

Warning, this article is outdated!, please refer to the newer article

Install Java SDK and JRE in Ubuntu ?

Want to install Java 2 SDK (j2sdk) in your Debian or Ubuntu? Well, I’ve created a home-made package for Java 2 SDK 1.4.2.

First download the deb from either of this mirror:

  1. Rapidshare.de
  2. Mirror #1

and after that, just do :
$ sudo dpkg -i sun-j2sdk1.4_1.4.2_09_i386.deb

and Sun Java 2 SDK 1.4.2 should be installed in your system by now. You can refer to https://wiki.ubuntu.com/Java if you want to build other Sun Java deb package (like Java 1.5.0)

That’s all for today folks, happy programming in Java!