Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* _____ _____ _ _____ _____ _____ _____ _____ _____
- ___| | __ |_| _ |_ _|___ ___|_ _| __| _ | |
- |_ -| --| -| | __| | | |- _|___| | | | __| | | | |
- |___|_____|__|__|_|__| |_| |___| |_| |_____|__|__|_|_|_|
- |s C R i P T z - T E A M . i N F O|----------------------------
- Get TVShow Banner from TheTVDB -> Upload to imgur
- RESULT:
- IMGUR iMAGE LiNK
- */
- define("TV_SHOW", "house");
- define("UPLOAD_URL", "http://imgur.com/upload?url=");
- define("IMG_REGEX", "/http:\/\/i.imgur.com\/[a-z0-9A-Z.]+/");
- function GET_($url)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- $source_code = curl_exec($ch);
- curl_close($ch);
- return $source_code;
- }
- function TV_SHOW_BANNER($title)
- {
- $url = "http://thetvdb.com/api/GetSeries.php?seriesname=" . urlencode(str_replace(".", " ", $title));
- $page = GET_($url);
- if (preg_match("/graphical\/[a-z0-9A-Z.\-]+/", $page, $match)) {
- $pic = $match[0];
- $img = GET_(UPLOAD_URL . "http://cache.thetvdb.com/banners/$pic");
- preg_match(IMG_REGEX, $img, $match);
- $imageUrl = $match[0];
- return $imageUrl;
- }
- }
- echo TV_SHOW_BANNER(TV_SHOW);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement