php - How to validate the google video code? -


in project, users insert google video code textbox - i'd certify video being referenced indeed exist. i'm presently using youtube api similar youtube references, i'm not sure best method google video. direction appreciated.

can request url , see if 404s or not?

function googlevideoexist($id) {     // validate id need     $id = (int) $id;      $headers = get_headers('http://video.google.com/videoplay?docid=' . $id, true);      // get_headers() follows location: headers,     // , sent in sequential order     foreach(array_reverse($headers) $header => $value) {         if (strstr($value, '200')) {           return true;        }     }      return false; } 

url above guide - adapt suit. also, can use curl if more comfortable that.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -