Category: General IT articles
12/05/10
Install ImageMagick on cPanel
On a cpanel web hosting server, to install ImageMagick you need to run if you got it running or not
# /scripts/checkimagemagick
If you installed Imagemagick via the rpm package
you can find if it is on your system or not by :
rpm -qa |grep image
If all the answers are no, you can simply install it by running
# /scripts/installimagemagick
To hook PHP to ImageMagick, you need to also install it via WHM
Log into WHM >> Software >> Module Installers >> PHP Pecl and install imagick to get the whole thing binding into PHP
04/05/10
Monitor if the remote host alive or not using PHP
The simplest way to find out if the remote host is alive or not is to use the ping utility. Pear provides such a convenient tool.
First, you need to install the right module
Code:
Here is the php
PHP: |
|
| require ("Net/Ping.php"); |
| |
|
|
| $ping = Net_Ping::factory(); |
| |
|
|
| if(!PEAR::isError($ping)) |
| { |
| $response = $ping->ping('REMOTE_HOST_IP_or_name'); |
| |
| if( $response->_transmitted > 0 && $response->_received ==0 && $response->_loss ==100) |
| { |
| mail("your email address", "remote host is not responding", date("Y-M-D H:i:s"), "From: your_email"); |
| }else{ |
| |
| } |
| |
| } |
The above code will send out email to you if the remote host is not responding. However, if the remote host is behind a firewall or if ping packets are blocked by firewall, the ping is not going to work.
05/03/10
Paypal Currency Codes
Code: | Code Currency Name Symbol |
| AUD Australian Dollars |
| CAD Canadian Dollars |
| CHF Swiss Franc |
| CZK Czech Koruna |
| DKK Danish Krone |
| EUR Euros € |
| GBP Pounds Sterling £ |
| HKD Hong Kong Dollar |
| HUF Hungarian Forint |
| ILS Israeli Shekel |
| JPY Japanese Yen ¥ |
| MXN Mexican Peso |
| NOK Norwegian Krone |
| NZD New Zealand Dollar |
| PLN Polish Zloty |
| SEK Swedish Krona |
| SGD Singapore Dollar |
| USD United States Dollars $ |
04/03/10
HTML Signature for Gmail
Gmail does not support rich text signature. That means you can’t have link, colors, images or any formatting with the Gmail signature.
There are ways to get around it.
1. copy and paste
Make your signature in Word and copy it to gmail’s composer each time you want to send an email.
2. Chrome/Firefox extension.
http://blankcanvasweb.com/pages/id_9/n_gmail_signatures/
The extension allows you to save your signature in your browser.
But if you use another PC, you will not be able to have the signature coming up automatically because it is saved to the PC where you installed the extension.
Regards,
Generate RSS feeds for your website
RSS newsfeeds and product feeds provide a variety of opportunities for increasing traffic to your website. Publishing your own feed is a great way to cut through the clutter of email spam and get your message directly to your target market. Interested parties can subscribe your RSS channel using common Email clients like Outlook. There are also many RSS readers available for Iphones or other smart phones.
RSS slowly becomes one of the important online marketing / SEO tasks.
Provided you already have an online product catalogue. Here is simple PHP code to use to generate a RSS feed:
PHP: | <?php |
| function xmlentities($str) |
| { |
| $xml = array('"','&','&','<','>',' ','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','­','®','¯','°','±','²','³','´','µ','¶','·','¸','¹','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ'); |
| $html = array('"','&','&','<','>',' ','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','­','®','¯','°','±','²','³','´','µ','¶','·','¸','¹','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ý','þ','ÿ'); |
| |
| $str = str_replace($html,$xml,$str); |
| |
| return $str; |
| } |
| |
| $pro = DB_DataObject::factory('Product'); |
| $pro->find(); |
| $xml ='<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/"> |
| <channel> |
| <title>Water Coolers from Wenlock Water coolers Ltd</title> |
| <link>http://www.wenlockwatercoolers.co.uk/rss.php</link> |
| <description>Water Coolers supplier - Wenlock Water coolers, Shropshire UK. We sell and rent water coolers to Business, Education and home users all over the UK</description> |
| <language>en-GB</language> |
| <docs>http://backend.userland.com/rss</docs> |
| '; |
| while($pro->fetch()) |
| { |
| $catName = $categoryArray[$pro->category]; |
| $xml .= "<item> |
| <title>". xmlentities(htmlentities(stripSlashes("$pro->name"))) . "</title>\n"; |
| $xml .= "<link>http://www.wenlockwatercoolers.co.uk/index.php?product_id=$product->id</link>"; |
| $xml .="<category domain='main'>". stripSlashes($categoryname_Name). "</category>"; |
| $xml .="<description>"; |
| $xml .= xmlentities(htmlentities(stripSlashes($pro->detail) )); |
| $xml .="</description> |
| <content:encoded> |
| <![CDATA[ |
| <table> |
| "; |
| |
| |
| } |
| $xml .='</table> |
| <br/>'; |
| $xml .="]]></content:encoded> |
| </item> |
| "; |
| |
| |
| } |
| |
| $xml .="</channel> |
| </rss> "; |
| header("Content-Type: application/xml; charset=utf-81"); |
| echo $xml; |
| ?> |
To test it, you can type in the URL to the php file in your IE to validate the XML.
You can use a RSS viewer to view the data of your deed:
http://www.netimechannel.com/OnlineRssViewer/
<< Previous Page :: Next Page >>
|
|