Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions classes/CrowdinPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,21 @@ public function downloadTranslations($language='all')
else
$url = "http://crowdin.net/download/project/{$this->identifier}/$language.zip";

return @file_get_contents($url);
if (function_exists('curl_version'))
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$content = curl_exec($curl);
curl_close($curl);
} else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) {
$content = file_get_contents($url);
} else {
//echo 'CURL is not installed, and allow_url_fopen is off, unable to download';
return false;
}
return $content;
}

public function info()
Expand Down Expand Up @@ -210,4 +224,4 @@ public function uploadTranslations($language, $src, $dest)

return $this->makeRequest('upload-translation', $data);
}
}
}