I have a php function that takes a URL from a user, checks if that URL is valid and exists, and then grabs the title of that URL. This works fine, except for URLs that redirect (eg : http://tintin.com
redirects to http://us.tintin.com
. In these cases, the function fails.
I then read that I need to add the following option -
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
I have added this, and yet the function fails, but I get no errors that pertain to this. Is there any proper way to debug this, or is there some other option I need to set apart from this, to get it to work?