Iphone/Ipad number format css style change in safari

Here's something interesting yet simple to share for a long time. If you are wondering and debugging countless hours for a very simple thing such as color change on a number format in ipad or iphone, you might just arrived to the correct blog post. We all know that debugging CSS and HTML in ipad or iphone isn't an easy task although we can emulate the environment, there are certain things we cannot emulate such as the behavior of the ipad or iphone OS itself. Interestingly, a client of mine faced such issue with their website where his 'contact' number listed on his website was changed to blue instead of white as declared on the css file when view on ipad or iphone.

Now, the odd thing is that even the emulator is showing the colors correctly. Debugged for a few hours without any luck but notice that  whenever i added alphabet into the numbers, it changes back to the correct colors. I though it was some javascript but it wasn't. In the end, i disabled the whole CSS and notice something different on the emulator and the ipad. Weirdly, ipad and iphone treat numbers as a link because it can be a contact on safari. Therefore, it automatically  wrapped around a group of numbers with an anchor link on a web page.  Therefore, your CSS declaration have to write something like

color: blue

and added something like

.style, .style a{
color: blue

if you wish to cater to ipad or iphone on your website. Even if you do not have a mobile stylesheet, ipad or iphone will still behave this way. Therefore, for any group of numbers on your website, just take note of such behavior on mobile devices such as iphone or ipad.

Simple Html Dom Fatal error: Call to a member function on a non-object

Simple Html Dom is a PHP dom manipulator. This library is one of the easiest and most powerful dom manipulator for PHP. In fact, you can even use this to create your own web crawler like what i have done. However, Simple Html Dom library isn't perfect. Although you are able to do almost everything without a problem using simple htm dom, the most problematic thing that will happen in a complex program would be to have different combination of URL. The combination of a URL is endless and this can cause simple html dom to fail.

I faced this problem with simple html dom where fatal error keep stopping my php crawler using simple html dom. The fatal error always occurs around "call to a member function on a non-object at...." and when I look at the fatal error link being process, it was perfectly fine. In PHP, we cannot really stop a fatal error without using some black magic which not always work. Like many people would have say, prevention is better than cure. Hence, doing a checking to determine whether the variable is an object before proceeding will definitely fixed this problem. If you think like many other people out there, this is most likely what you would have done and bet that it will definitely fix your problem.

$html = file_get_html($url);
   foreach($html->find('img') as $img){
      //bla bla bla..

Well, the above might work in some case but not all. when file_get_html failed, it will return false regardless of 404 or 500 occurs on the other side of the server. Hence, you may do this as well,

$html = file_get_html($url);
   foreach($html->find('img') as $img){
      //bla bla bla..

But if it still doesn't solve your problem which it really shouldn't be able to take care of all cases, you might turn to do the following,

$html = file_get_html($url);
if($html && is_object($html)){
   foreach($html->find('img') as $img){
      //bla bla bla..

Well, if this still doesn't work and your brain is stuck, you might feel lucky this time that you come to this blog of mine.

Simple_Html_Dom Fatal Error Solution

The solution for your problem is actually quite simple but not direct. However, i have tested this with almost few hundred thousands of different URL so i can confirm you that this will definitely solve your fatal error and get rid of the "call to a member function on a non-object" especially when it reaches "find". The solution is simple, using the above example, we will just have to add in a condition where it doesn't fail and the object was created by simple html dom class but it doesn't contain any node! In this case, you should write something like the following,

$html = file_get_html($url);
if($html && is_object($html) && isset($html->nodes)){
   foreach($html->find('img') as $img){
      //bla bla bla..

In the above example, i uses all the true condition but in my real program i was using all the false condition (is false). But it should still works. I tested this for a few days as the bot was required to run for a few lots of hours before i bang into a fatal error. This is really a wasteful of time. But the solution is rewarding. I hope this help some fellow out there 🙂

How to enable gzip on your cpanel shared hosting

I've explained how to install memcache, htmltidy and csstidy on your centos machine. However,  the most important thing that every webmaster should know and enable would be your gzip. By default, cpanel did not enable gzip for you. You will have to access your cpanel to enable gzip yourself. This can significantly increase your website speed and its a must to do list if you are a webmaster. In order to enable your gzip, you will have to access your cpanel. Once you are in your cpanel, find the following icon.

and click on the following option.

And click update. It is that simple to enable gzip for your shared hosting and speed up your website!


21 Tips To Find A Good Shared Web Hosting Company

Recently i was looking for a local shared web hosting company to move my new project from my current host to a local one. Similarly like everyone in the world who wished to look for new things, they would research and so did i. And because of my previous experience on finding my current US web hosting company, hostgator, which is a long and tiring journey due to many fake and incorrect information that people (i can't really really say company) made online for monetary purposes. It's always easy to fall prey into all these online marketing tricks. So i decided to list down all the tips i used to find a good web shared hosting company in the case where i need to change to a new hosting company (hopefully not).

Shared web hosting

Like everyone would have known the fact that a shared web hosting means there are a lot of people sharing a single server with you. Sharing doesn't mean that your website will run slower or it will be worst than a dedicated server. It really depends on your website needs. Your website might be a static page that only needs less than 0.1% (or even lesser) on a full dedicated server so putting your site in a shared environment will be the best in terms of cost and efficient. However, there are cases where people abuse the resources in a shared environment which is also why many web hosting company have turned to restrict the amount of resources one can utilize which is a good move in a shared environment. Hence, your only concern on a shared hosting service is whether people in your server is behaving properly or utilize minimum server resources. (so that there is enough for everyone)

Shared web hosting company

Now let's talk about shared hosting company. There are tons of them. Majority is overselling. These are the facts and most of us know it once we read their shared web hosting plan. Especially in US where majority company is telling you the word UNLIMITED. And DAMN that's a very VERY attractive word that ALL people love. (human have unlimited wants but there are limited resources, eg. we want unlimited beautiful woman but there are only limited beauties) And usually a novice who read the first site that offered UNLIMITED hosting plan will most likely fall into their marketing scheme (ITS YOU RIGHT?! haha..). But its pretty common nowadays especially people who are just stepping into the world of spammers, opps, i mean world of web hosting services. Everyone wants to earn some money and this doesn't exclude shared web hosting company. New or existing shared web hosting company, they all are staring at your pocket. The key is not to show them the money quickly. I talked as if they are all spammers. Definitely, there are ones that provides you with excellent services but out of so many shared web hosting company, who do you choose? 🙁

Tips To Find Good Hosting Company

After the long read of crap and nonsense, i'm finally getting back to what i aim to write, My Tips. Some are obvious, some are not. Just take those you want 🙂

Your Needs. Don't be greedy

I'm greedy. And this is where i always paid more for something i might not EVEN need. It's like when you hungry and order tons of food but couldn't finish them in the end. The same things applied on web hosting service. The trick is to estimate how much you need for both bandwidth and space. For an image gallery where there are few thousands visitors a day. You will need quite a lot of bandwidths while a normal website that doesn't serve as much images won't need that much of space and bandwidths. Hence, look at what you are serving and determine which plan suit you the best. (unlimited packages usually disappoint you more than satisfy you. Depending on the size of the company,  they might not have the resources to provide unlimited package)

Number of Website Hosted in a server

You need to know how much website is hosted in a particular server. If one server hosted more than a thousand websites, the probability of your site getting your resources will be very limited. Imagine more than one thousand website fighting that limited resources in a server. Hence, look for some company that do not over host their server and cause headache for you in the near future.

Number of Account in a server

You might probability be aware that there are a lot of web hosting that claims unlimited web site on a domain. This is great news for everyone but each account with unlimited website will means MANY MANY website on a single server. Therefore, its wise to know more about your web hosting company setting on the number of account allowed per server.

Server Location

Depending who your audiences are, your server should be close or near them. This benefits both you and your target audiences of your website because there are less expensive routing towards your website which makes your website more accessible. On the other hand, you can monitor or manage your website faster than a web hosting companies that is across your region.

Any Database Size Limitation

Know your web hosting company well. Some web hosting company (most) do not tell you the limitation they impose on the database size. Once, you reach that limit that database can no longer place more data into it. This is bad for you and you should be aware of it before signing up with them.

CPU and Memory Limitation

CPU and memory limitation is a common knowledge in shared web hosting nowadays. As long as you are using a shared web hosting service, you should be aware of this limitation. Knowing this help you to find the least restrictive web hosting company with the best value.

Server Specification

In a shared environment where everyone uses the same resources, one must know that the server is powerful enough to serve the amount of website limited by the company in the server. Some still uses their old server to host the same amount of website as a latest server. You might want to avoid those server to avoid unnecessary problem.


Knowing when and what they backup is important for you in case anything went wrong with their server. Especially the information on the limitation impose when they stop automatic backup for you. There are many cases where they will stop their automatic backup system for your account due to various reasons. And these reasons might make you avoid the company.

Time of Establishment

A reputational web hosting company means you are safer with them. This means that you can have more confident that they won't suddenly bankrupt and went missing (something you see in my country) and your data won't be stolen because your website did great and many ridiculous problem you might face with a untrusted hosting company (To began with, they do not have any reputation to spoil).

Any limitation on the number of domain/subdomain

If you like to have one hosting plan with multiple domain. You should aware of the number of domain/subdomain the plan offer you to prevent any unnecessary regrets.

Any limitation on each email account size

Some web hosting company impose a maximum email account size limit to prevent spam from over flooding their web server. If you are a person who dislike such restriction be sure to look properly before signing up with any company.


Another way to know whether they are good is to ask lots of questions and determine their responsiveness and correctness. A responsive and knowledgable support team will most likely make you more happy than angry in the future. Email different section to enquire anything from heaven to earth especially when you are sure ITS THAT COMPANY you want.

Maximum number of database connection

Some company restrict the number of database connection or users you can have. Having unlimited addon domain without having different database user or connection is like cutting your leg off while giving you sticks to walk. Without knowing such limitation and bang into a web hosting services will not do you any good.

Other Service Fees

Some company charge you service fees for some technician assistance. This is an information you should know to help yourself cut down some heavy addon fees on your web hosting when support become chargable. Ask your web hosting services what are chargeable and determine whether its reasonable before joining the club.


Another interesting thing you should be aware of is the connection speed use to power their web hosting service. Connection is also one of the important thing you would like to compare against different web hosting company.

Technical support, not so technically skill

This is a common scenario where their technical support give you stupid answer or incorrect one. Some even give you those default answers that was given by the company. Finding a good support will take you a long way in the future.

Talk to people

Find out from people who are currently using the company web hosting service. I'm sure they will share with you their experiences with them and you can better determine whether they are the one for you.

Use tool to verify

After you have enquire. You can further verify some of the information given by using some of those free web based tool. I personally used yougetsignal.com where it can tell me the number of website hosted in an IP address, location of the server, etc. This help you ensure that you are not being marketed and they are honest with their words.

Server hosting company

Another thing you might want to check with your web hosting company is their server hosting company. Their downtime depends greatly on them.

Check IP

Check their IP in one of those spam ip checker online. Determine whether their IP is considered as spam is important as many internet provider would block these ip to protect their users. This will also means your website will be considered as spam site.

Other tips

Other tips can be found on my review page on hostgator.


The trick here is to always ask for information not available on their website. These are most likely the information they wish to hide. But they can always trick you when you ask and that is why money back guarantee is so important to us.

Integrate Paypal Express Checkout Solution

As a web developer, there will surely be someday where you wish to integrate Paypal into one of your products or services. The most appropriate way is to read the documentation provided by Paypal. But reading it doesn't mean you will understand the documentation with one shot and this call for a lot of research and finding before your Paypal will work. I went through this process these few days that is why there wasn't much article written in the process.  Although it wasn't really difficult but going through the process of reading first before looking into their sample codes really wasn't the correct way of approaching this solution. Instead, looking into the sample code will definitely brings light to integrating Paypal express checkout solution (well, you still have to read a bit). In this article, i will try to demonstrate Paypal express checkout solution as simple as possible for you guys to be able to DIY.

Paypal Express Checkout

What is Paypal Express checkout solution? Paypal Express Checkout makes it easier for your customers to pay and allows you to accept PayPal while retaining control of the buyer and overall checkout flow. This means that you can integrate a payment solution with Paypal that retain most of the interaction on your website other than user login and verifying the product they are purchasing. Paypal express checkout also provides you with the ability to create recurring payment which can really eliminate the need to repurchase the exact service or product every single time. However, Paypal express checkout solution doesn't have the ability to allow your user to use credit card for purchases. Your customers must have Paypal in order to purchase with this solution. Credit card solution will only be available together with Paypal in Website Payment Pro solution. Hopefully this clear some doubt and help you select what solution you really need.

Integrate Paypal Express Checkout Solution - Step 1

Firstly, you might wonder where exactly are the correct documentation out of all the places in Paypal. You can get the documentation and Sample at the respective links. The sample is contain at the section PayPal API: Name-Value Pair Interface as i believe this will give you a better understanding on the flow of Paypal express check out solution. The sample files will required you to throw them  into your server and run (go to the browser and key in the url you have thrown the folder into) as it will simulate some of the payment flow you might want. Then you will look into the code and see how they are achieved. Please take note that localhost might not work for you as it will required you to have curl installed.

Integrate Paypal Express Checkout Solution - Step 2

Once the sample are placed into your server and you have play around, the next thing you might wonder is the exact file you will required to run your own Paypal express checkout solution. And here are the files you will only need.

  • APIError - display error
  • CallerService - main player that initial the talk
  • constants - all the required variables
  • SetExpressCheckout - display for step 1 of the process
  • GetExpressCheckoutDetails - display for step 2 of the process
  • DoExpressCheckoutPayment -  display for step 3 of the process + send final request to paypal
  • ReviewOrder - request handler for step 1 and responsible to redirect to step 2

The files i am looking at are all PHP files.  Well, the above file respective function should be self explained. The first 3 files(APIError, CallerService and Constants) are the files imported into the ReviewOrder and  DoExpressCheckoutPayment files as they are required to talk to Paypal. Once we understand this it is time to go into a more complicated stuff.

Integrate Paypal Express Checkout Solution - Step 3

To illustrate what is going on in the sample file, we will look at the following diagram provided by Paypal.

From left to right, we have 5 interfaces user will see. And two of them are display from Paypal where it is colored in blue (2nd and 3rd interface). Hence, we left with 3 interfaces which are SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment which is 1st, 4th and 5th interface respectively.  So we are all clear with the display files right now. Next we will need to know where ReviewOrder will appear. There are altogether 4 Calcuts as written on the diagram. The ReviewOrder will be triggered on the 2nd and 3rd Calcuts where SetExpressCheckout API and GETExpressCheckoutDetails API is being fired. Don't worry about what does these API means at the moment. Just treat them as a method that will tell Paypal what they do.

Integrate Paypal Express Checkout Solution - Step 4

I guess everyone should understand how Paypal work looking at the sample file and the explanation above.  Next i will explain some of the important things you will need to know since writing all the codes here is meaningless as they are the same for every sample files. It just makes it more confusing to read. Firstly, for each request made to Paypal, you will always see the following line in the sample file.


where $nvpstr is the name-value pair string passed into the method hash_call. What this function hash_call does it to send the request to Paypal to notify them the action you performing. In this case, SetExpressCheckout API is being performed here. There are also other API as mention previous such as GetExpressCheckoutDetails API and DoExpressCheckoutPayment API. These are the three API you will need to talk to Paypal in each stage shown on the previous diagram. So we should all clear about what does API mean that are written all over the Paypal documentation. The next important step is to know what name-value pair does each API required you to send in order for Paypal to understand you.

Integrate Paypal Express Checkout Solution - Step 5

Here we will see what does each API in the process of express checkout required. For SetExpressCheckout, you will required to have the following name-value pair in your string.

  • AMT

That is all! But in the sample it gives you more than just the above which is pretty good to understand what can be dump into the nvp string for it to display what you want on the paypal website where your user gets redirected.

For GetExpressCheckoutDetails API is pretty simple. It will just required you to have a token passed into the nvp string and this token can be retrieved via $_GET method where Paypal send it through there.

Lastly, for DoExpressCheckoutPayment API, you will need to provide the following nvp for it to work.

  • AMT

And that's it! The value forGetExpressCheckoutDetails and DoExpressCheckoutPayment API are provided by Paypal during the process while SetExpressCheckout data are given by you.


I believe the above explanations were pretty clear. But i still used quite a hell lots of time working on it *SLAP MYSELF*! This article is intended to provide any newbie on Paypal to get the hang of integrating Paypal without the need to spend time on reading and learning all about Paypal integration. However, the sample provided by Paypal is not secure and is only used to serve as a demonstration on 'how integration can be made easy'. I believe this article will be pretty useful for anyone to understand how Paypal work rather than reading few thousand words given by Paypal and never direct you to the correct sources or code (other than more documentation). Guess what? I found this Paypal Integration Wizard which is a wizard that creates all the above codes for you! :[