Grabbing images

A place for developers to advertise their TheTVDB.com enabled app and get help from other developers with the API.
Tracy
Posts: 3
Joined: Wed Oct 24, 2018 4:16 pm

Grabbing images

Postby Tracy » Wed Oct 24, 2018 5:13 pm

Hi All

I'm trying to download a banner for a series using the latest api and am not getting very far. I'm using CURL but the file I'm getting is actually a 404 html file with an image name.

This is the code I'm using, can anyone tell me the problem?

Code: Select all

         $ch = curl_init('https://www.thetvdb.com/artwork/1313525');
         $fp = fopen($seriesBanner, 'wb');
         curl_setopt($ch, CURLOPT_FILE, $fp);
         $headers= array('Accept: image/jpeg','Content-Type: image/jpeg','Authorization: Bearer ' . $serverToken);
         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
         curl_setopt($ch, CURLOPT_POST,0);
         curl_exec($ch);
         curl_close($ch);
         fclose($fp);