Yesterday Rob, a co-worker and friend, had one of these great ideas that helped us to solve a issue of visualization of content on a user agent. Just imagine you trying to see an error of CSS how it supposed to be without a virtualbox or a Windows XP for IE 6. It’s a hard deal to work it out, but there is a solution that might help any developer no matter what is the web-language that he programs on.
The principle is simple, use cURL to request the url that you are having issues and print the output. It is a very simple concept that will help more than a ton.
Here is the piece of code that you will need to do the request:
$url = ‘https://mcloide.wordpress.com/‘;
$userAgent = ‘Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)’;
$browser = curl_init($url);
curl_setopt($browser, CURLOPT_HEADER, true);
curl_setopt($browser, CURLOPT_RETURNTRANSFER, true);
curl_setopt($browser, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($browser, CURLOPT_USERAGENT, $userAgent);
$output = curl_exec($browser);
This little piece of code will help you on getting weird bugs worked out.
It’s Friday, have fun.