This error means that your PHP setting prevents you from tracking your location. There are several ways that you could solve the problem without installing additional libraries, as suggested by @mario.
- If you own the server or have root access, you can modify the php.ini file to disable safe_mode.
- .htaccess
php_value safe_mode off . ini_set('safe_mode', false); PHP .
, - :
$ch = curl_init('https://sso.uc.cl/cas/login?service=https://portaluc.puc.cl/uPortal/Login');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username=' . urlencode($usuario) . '&password=' . urlencode($pw));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$result = curl_exec($ch);
curl_close($ch);
if ( ! empty($result) )
if ( preg_match('/Location: (.+)/i', $result, $matches) )
{
}