better alternative to cURL in php -


i have large database of remote mp3 urls of various websites both old , new. using following code check whether urls valid mp3 or not in php

function check_url($url) {      $ch = curl_init();     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_header, 1);     curl_setopt($ch , curlopt_returntransfer, 1);     $data = curl_exec($ch);     $headers = curl_getinfo($ch);     curl_close($ch);       if($headers['content_type']=='audio/mpeg'&&$headers['http_code']=='200')         return 1;     else             return 0; } 

it consuming huge execution time. can suggest other alernative perform task.

we can use php built in function

$headers=get_headers($url); print_r($headers); 

returns following

array (     [0] => http/1.1 200 ok     [1] => date: tue, 07 jul 2015 16:53:22     [2] => server: nginx/1.4.1     [3] => last-modified: tue, 19 oct 2010 22:06:24 gmt     [4] => etag: "4cbe1660-7807f6"     [5] => accept-ranges: bytes     [6] => content-length: 3493158     [7] => connection: close     [8] => content-type: audio/mpeg ) 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -