I am using the following code, in PHP, to get the thumbnail (from the JSON) of a vimeo video according to the vimeo API
private function curl_get($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
$return = curl_exec($curl);
curl_close($curl);
return $return;
}
After profiling the page I noticed that it takes to curl_exec about 220 milliseconds, which I find a lot considering that I only want the thumbnail of the video.
Do you know a faster way to get the thumbnail?
it takes to curl_exec about 220 milliseconds
It's probably the network overhead (DNS lookup - connect - transfer - fetching the transferred data). It may not be possible to speed this up any further.
Make sure you are caching the results locally, so they don't have to be fetched anew every time.