Use PHP and cURL to retrieve URL contents (with a few options)

url_get_contents - a function to retrieve the contents of a remote URL with PHP and the cURL library.[break]Because I've used this function for a few different projects, it's grown to be a bit of a monster, however you can still use it in a pretty basic way, i.e. url_get_contents("");

I'm not a professional programmer by any means, and I suffer from lack of organisation of common code that I use. So, I'm going to post a few of the things that I hunt for here, to save myself a bit of a search. Hopefully they may be useful to someone else too.

Get viewport/window size (width and height) with javascript

While finding out monitor resolution with javascript can be useful for statistics and certain other applications, often the need is to determine how much space is available within the browser window.

Space within the browser window is known as the 'viewport' affected by the monitor resolution, how many toolbars are in use within the browser and whether the browser is in full screen or windowed mode.

Javascript Redirect Scripts

Redirecting a visitor with javascript is pretty straightforward. The simplest way is to use one of the methods below.

Note that in some cases a server-side redirect (i.e. one using a language such as PHP, ASP or Perl) is a better choice, since not all users will have javascript enabled. Search engine spiders are unlikely to follow javascript based redirects.