1

我在 PHP 中使用以下代码根据vimeo API获取 vimeo 视频的缩略图(来自 JSON)

    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;
}

在分析页面后,我注意到 curl_exec 大约需要 220 毫秒,考虑到我只想要视频的缩略图,我发现了很多。

您知道获取缩略图的更快方法吗?

4

1 回答 1

3

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.

于 2012-02-22T12:02:20.047 回答