When I call the YouTube V3 API for a list of videos by playlist ID, I get the correct results when calling the API via Postman, but outdated results (missing today's newly uploaded video) when calling the API via cURL with PHP. I think maybe I am getting cached results with cURL but I don't know why that would be the case.
My PHP code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=$playlistId&key=$api_key&maxResults=50");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Cache-Control: no-cache"
));
$json = curl_exec($ch);
curl_close($ch);
My Postman request:
Type: GET