protected function MolliePaymentInstaller::downloadLatestsMollieApiClient in Mollie Payment 7.2
Downloads the latest version of the client.
Return value
string|bool The path of the download or false if the client could not be downloaded.
Throws
\Exception
1 call to MolliePaymentInstaller::downloadLatestsMollieApiClient()
- MolliePaymentInstaller::installMollieApiClient in includes/
mollie_payment.installer.inc - Installs the Mollie API client for PHP.
File
- includes/
mollie_payment.installer.inc, line 260
Class
- MolliePaymentInstaller
- Class MolliePaymentInstaller.
Namespace
Drupal\mollie_paymentCode
protected function downloadLatestsMollieApiClient() {
$url = $this
->getLatestsMollieApiClientUrl();
// Fetch data from the URL.
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ($info['http_code'] == 200 && $response) {
// Write the data to a temporary file.
$temp_name = drupal_tempnam('temporary://', 'file') . '.zip';
if (file_put_contents($temp_name, $response) !== FALSE) {
return $temp_name;
}
}
else {
throw new \Exception(curl_error($curl));
}
return FALSE;
}