XMLFormatter2

XMLFormatter2 is a XML beautifying tool deriving from XML_Formatter originally developed by Žilvinas Šaltys. If you are in need of handling big files you should still resort to that solution, since it reads chunks of data at a time using file streams. Maybe at some point I will integrate that too…. (or maybe I should just simply do it right now).

So what is it about:

  • it is a very small PHP class
  • taking an XML input string
  • fixing XML indentation (indenting being the reason I first looked for the original tool)
  • and finally giving you an nicely formatted XML output string as a result

If you are looking for an easy way to indent XML strings in PHP this is for you. The most common usage example would be a requirement to fix the reading style of some “compressed” XML string you got from a third-party application.

Here a quick usage example:

require_once("XMLFormatter2.php");

$data = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>....';

try {
  $formatter = new XMLFormatter2();
  echo $formatter->format($data);
} catch (Exception $e) {
  echo $e->getMessage(), "\n";
}
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

DOWNLOAD:  XMLFormatter2 (6362 downloads )

RSS Feed Generator 1.0 (RSS1, RSS2, ATOM)

This is a very simple RSS Feed Generator for PHP.

ORIGINAL GPLed VERSION of “Universal Feed Writer” by Anis uddin Ahmad found
here.

The changes applied include, but are not restricted to:

  1. easier to read identation and documentation, a little code cleanup
  2. both classes FeedWriter and FeedItem in one file
  3. header updated to be application/xml, charset utf-8
  4. single elements with no content can now be added like ‘
  5. namespaces can now be added manually
  6. channel elements can now have attributes
  7. all relevant methods now return $this (concatenation)

The included RSS2 example application is running directly on this URL – have fun and let me know about bugs!

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...

DOWNLOAD: RSS Feed Generator for PHP (6387 downloads )

iPhone / iPad VPNs to Ubuntu Server 8.04/10.04 (v1.0)

Initialization of change-relevant information in domain objects after calls to loadDB added. Some more cleanups to various methods as suggested by Luca.

Thanks again!

This covers L2TP over IPsec (as supported by iPhone/iPad) and securing L2TP with iptables.

The story began a few days ago as I stumbled across the idea of having VPN connections from my iPhone/iPad to my servers. Even though there is loads of information about it on the net, there is nothing that really covers it thoroughly the way I needed it. To tell the truth: there is nearly nil information available on how to configure iptables on a 2.6 kernel to shield L2TP… well here is a try to help some of you guys.

Beware – these are examples are meant to allow you to create a 1:1 VPN to a single host/server. In order to build a VPN tunnel (1:n through a firewall) you will have to modify this a bit. If anyone is interested, let me know!

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...
DOWNLOAD: iPhone / iPad VPN and firewall example configuration (5665 downloads )

CSS support for column width in “service details”

This patch has been created against Nagios version 3.0.6 but could still work in future versions that make use of Nagios’ C-based CGI interfaces.

Change into the source tree and apply the patch:

  • cd nagios-3.0.6
  • patch -p 0 < status.c-column-width-patch.diff

In order to set the column width edit the apropirate CSS file (share/stylesheets/status.css) and add these lines, while changing them as needed:

.statusHost {  }
.statusService { width: 300px; }
.statusStatus {  }
.statusCheck {  }
.statusDuration {  }
.statusAttempt {  }
.statusInformation {  }

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

DOWNLOAD: CSS column support for (4783 downloads )

SNMP Agent simulator (Net-SNMP/PHP)

This little (quick and dirty) application allows you simulate any kind of SNMP agent, just by having an export of its numeric OID tree.

For instance this is usefull for offline-development of new check-plugins. You don’t need physical access to the SNMP server running the agents. All you need is a numeric SNMP-dump of the actual tree you are interested in, which may be obtained in a single on-site run. An example of the LanManager (77) tree beyond enterprises (1.3.6.1.4.1) could look like:

  • snmpwalk -O n -C c -c public -v 2c myhostname 1.3.6.1.4.1.77 | sort >lanmgr.dump

While some agents don’t supply OIDs in increasing order, we can work around that using “-C c” and “sort” in this example.

As soon as you are done with this just copy the output (here “lanmgr.dump”) and integrate it into your own SNMP daemon. In order to add the LanManager tree to your local Net-SNMP daemon you would add the following line to /etc/snmp/snmpd.conf:

  • pass_persist .1.3.6.1.4.1.77 /usr/local/sbin/mySNMPagent.php /tmp/lanmgr.dump

ATTENTION: this is a tool in very early stage of development. While it may be useful for a lot of cases, there was no heavy testing so far. Multiline hex-output is not yet supported. Other stuff may be missing.

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...

DOWNLOAD: mySNMPagent (4403 downloads )