תמיכת The Movie Database

I am trying to run a PHP script on Hostinger. My script is working fine on my local server but over Hostinger, script is throwing 403 forbidden error. I have checked for CURL (enabled) on hostinger.

This is my code.

public function getdata($url='http://api.themoviedb.org/3/tv/ontheair?apikey=####&page=1'){
$ch = curl_init();
        $ua = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36";

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_USERAGENT, $ua);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);

        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json",
            "Accept: application/json"
        ));

        $this->response = curl_exec($ch);
        var_dump(curl_getinfo($ch) );
        var_dump(curl_error($ch) );
        var_dump(curl_errno($ch) );
        curl_close($ch);

        var_dump($this->response);
        $obj = json_decode($this->response);
        $results = $obj->{'results'};


        return $results;
    }

6 תגובות (בדף 1 מתוך 1)

Jump to last post

Hi console0hack,

The API key parameter is actually api_key (note the underscore). Are you setting apikey or api_key?

Other than that (could have just been a paste issue) I'm not sure if I see anything else wrong… we don't do anything other than check the API key. There's no difference on our end whether you connect from localhost or a server. Enabling some more verbose logging would probably help.

Sorry, it was just a copy paste mistake. I am using $url = "http://api.themoviedb.org/3/tv/on_the_air?api_key=####&page=1" ,and this is working fine on local server but in case of remote server (hostinger) it is throwing 403. Is there any chance that Hostinger is blacklisted?

I have tried by enabling verbose logging too but no help. It returned

Verbose information:

  • About to connect() to api.themoviedb.org port 80 (#0)
  • Trying 54.225.223.192... * connected
  • Connected to api.themoviedb.org (54.225.223.192) port 80 (#0) > GET /3/tv/on_the_air?api_key=####&page=1 HTTP/1.1 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36 Host: api.themoviedb.org Accept: /

< HTTP/1.1 403 Forbidden < Content-Type: text/html < Date: Thu, 12 Mar 2015 07:14:26 GMT < Server: nginx < Content-Length: 564 < Connection: keep-alive <

  • Connection #0 to host api.themoviedb.org left intact

Hi console0hack,

Maybe… what's the IP of the server you're connecting from? We do have some IP blocks in place from users who have in the past, abused our service. I'll need the IP to check though.

I am using shared hosting at www.hostinger.in. And I think IP is 31.170.163.241 or 31.220.23.1

I am using shared hosting at http://www.hostinger.in/ and my server IP is 185.28.20.18. I want to know if it is blocked. And if it is blocked is there any way around that I can use your
API from this server?

Hi console0hack,

Sorry for the delay. I was waiting for one of our guys to get back from vacation.

Indeed, the 31.220.x.x and 185.28.x.x IP ranges are some of the IPs we have blocked. Unfortunately there won't be anything we can do. You're free to move to another host of course, but we have blocked these because of massive abuse histories and won't be unblocking them.

Cheers.

.לא מצאת סרט או סדרה? היכנס כדי ליצור אותם

עולמי

s התמקד בשורת החיפוש
p פתח תפריט פרופיל
esc סגור חלון פתוח
? פתח חלון קיצורי דרך של מקלדת

בדפי מדיה

b לך חזרה (או אל הורה אם ישים)
e לך אל דף עריכה

בדפי עונות

(חץ ימני) לך אל העונה הבאה
(חץ שמאלי) לך אל העונה הקודמת

בדפי סדרות

(חץ ימני) לך אל הפרק הבא
(חץ שמאלי) לך אל הפרק הקודם

בכל דפי תמונה

a פתח חלון הוספת תמונה

בכל דפי עריכה

t פתח בוחר תרגום
ctrl+ s הגש טופס

בדפי דיון

n צור דיון חדש
w עורר מעמד צפייה
p עורר ציבורי/פרטי
c עורר סגירה/פתיחה
a פתח פעילות
r השב אל דיון
l לך אל תשובה אחרונה
ctrl+ enter הגש את הודעתך
(חץ ימני) הדף הבא
(חץ שמאלי) הדף הקודם

הגדרות

?רוצה לדרג או להוסיף פריט אל רשימה

היכנס