praneeth praneeth - 1 year ago 116
PHP Question

file_get_contents() for short urls

doesn't read data for short urls



Please help me in handle this. OR Is there any CURL function to handle above links?

Answer Source

This in general works fine. If you find it doesn't do the right thing you can explicitly use a stream context:

$url = "";
$context = stream_context_create(array('http' => array('max_redirects' => 5)));
$val = file_get_contents($url, false, $context);

should do it. No need to touch CURL for that.