Find the line curl_setopt(CURLOPT_FOLLOWLOCATION, true); in your script and remove it, that will fix the error (seems to be line 107).
While safe_mode is off, open_basedir is ON and will remain on for security purposes (without it, people would be able to access the files in other people's...