Category Archives: PHP Solutions

Simple Server Response Checker With PHP and cURL

I often need to check website lists for error codes (yesterday I’ve told you about 4XX codes). There is a simple solution written in PHP that allows to d this. You need cURL support enabled (please, let me know if I need to describe cuRL installation process on my blog) and that’s all. Here is the code: <?… Read More »

Encoding ASCII Characters in URL – PHP Solution

Sometimes you need to encode the whole URL, not just specific characters that are encoded with urlencode(). You might need to represent your query string or anything else as shown at W3C School. There is quite a simple solution in PHP: <? $string=”some-string”; for ($i=0; $i<strlen($url); $i++) { $mass[$i]=”%”.dechex(ord($url{$i})); } $encoded_string=implode(“”, $mass); ?> In the sample provided the… Read More »

How To Enable Register Globals in PHP Without Access to php.ini

Sometimes you need to use the variables passed to script avoiding usage of superglobal arrays. If you are on shared hosting, you won’t have access to your php.ini file and won’t be able to change register_globals setting. A simple function will help you to do this. <? /** * function to emulate the register_globals setting in PHP *… Read More »

Iconv Encoding List And PHP Usage

Iconv functions are often used in PHP when you have problems with character encoding. When you have non-latin chars in the text you work with, you might have problems with storing them, writing into database, etc. It becomes useful when you use several different encodings and when you need to store or output some text into a single… Read More »