Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (preg_match("/http/",$url_files)){
- $ch = curl_init($url_files);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
- $out = curl_exec($ch);
- $image_sv = 'путь_куда_вы_сохраняете_картинку'.$nm.'.jpg';
- $img_sc = file_put_contents($image_sv, $out);
- curl_close($ch);
- }
- use MCurlClient;
- $urls = array(
- 'ht tp://cs1-38v4.vk-cdn.net/p13/cdfeaeaf00705d.mp3',
- 'ht tp://cs1-32v4.vk-cdn.net/p2/5c0972b283ee17.mp3',
- );
- $save_path = '/tmp';
- $client = new Client();
- do {
- while ($client->has()) {
- $result = $client->next();
- // Пересохраняем рисунок с ошибкой
- if ($result->hasError()) {
- $urls[] = $result->options[CURLOPT_URL];
- }
- }
- foreach($urls as $url) {
- $file = $save_path . '/'. basename($url);
- $client->add([
- CURLOPT_URL => $url,
- CURLOPT_FILE => fopen($file, 'w'),
- ]);
- }
- $urls = [];
- } while($client->run() || $client->has());
Add Comment
Please, Sign In to add comment