http - YouTube API returning correct results in Postman, but outdated results with PHP cURL
Get the solution ↓↓↓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
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: too few arguments to function laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.