This simple snippet of code will help you get the full URL of the currently viewed page. function getUrl(){ $domain = $_SERVER[‘HTTP_HOST’]; $url = “http://” . $domain . $_SERVER[‘REQUEST_URI’]; return $url; }
Category: Backend Development
How to Dynamically Shorten URLs with TinyURL?
The URL shortening service TinyURL.com provides an API for programmatically processing URL shortening requests through your own script.
How to Grab Youtube Video Thumbnail?
Getting the thumbnail of a Youtube video through it’s ID is not that hard. You just have to transform the URL a little bit to get a high quality JPG file, used as a main thumbnail through Youtube.com.
How to Assign the Same Value to Multiple Variables?
This is a simple tip but most experienced PHP programmers don’t know that it even exists.
Stop WordPress Comment Spam
Yes, Akismet can be of huge help when fighting with comment spam, but it can’t help against the most sophisticated auto-commenting tools which make fake comments look very real.
How to Fix a “unexpected $end” Error
Sometimes you will get an error similar to this in PHP: Parse error: syntax error, unexpected $end in /index.php on line 36 This is most likely caused by a forgotten closing curly bracket (“}”). [ad name=”In Post (LU)”] If you have a PHP code similar to this you will definitely get the above error: