Coder Social home page Coder Social logo

Comments (9)

croustibapt avatar croustibapt commented on June 28, 2024

Bonjour,

j'ai exactement le même problème mais je n'arrive même pas à faire fonctionner le "basic-fr.php". Aucun résultat retourné et ce Warning omniprésent.

Quelqu'un à une idée ?

from api-allocine-helper.

croustibapt avatar croustibapt commented on June 28, 2024

Ok, trouvé. Allociné a changé ses appels aux webservices ce qui rend obsoléte cette API. J'ai réussi à contourner le problème en changeant la méthode pour créer les URL de requête. Il faut simplement changer la méthode creatURL par celle-ci :

    function creatURL($type) {
        $this->set(array(
            'format' => 'json',
            'partner' => ALLO_PARTNER
        ));
        $arTokens = array();

        foreach ($this->getPresets() as $cle => $valeur) {
            if (is_string($cle)) {
                if (is_array($valeur)) {
                    $arTokens[$cle] = implode(',', $valeur);
                } else {
                    $arTokens[$cle] = (string) $valeur;
                }
            } else {
                $arTokens[$cle] = (string) $valeur;
            }
        }

        $sed = date('Ymd');
        $bDone = ksort($arTokens);

        foreach($arTokens as $key => $value){
            $arTokens[$key] = $key.'='.urlencode($value);
        }
        $sig = urlencode(base64_encode(sha1('e2b7fd293906435aa5dac4be670e7982'.implode('&',$arTokens)."&sed=$sed",true)));

et utiliser cette constante désormais :

define('ALLO_PARTNER', 'V2luZG93czg');

Je n'ai pu tester pour l'instant qu'avec une requête de type "movie" et cela fonctionne.

Pour le warning omniprésent, je pense que ce n'est absolument pas lié.

from api-allocine-helper.

croustibapt avatar croustibapt commented on June 28, 2024

Il vous faudra également utiliser cette fonction désormais :

   protected function getDataFromURL($url) {
        if (function_exists("curl_init")) {             
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_URL,$url);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
            $agents = array(
                'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
                'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100508 SeaMonkey/2.0.4',
                'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)',
                'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1'
            );
            curl_setopt($ch,CURLOPT_USERAGENT,$agents[array_rand($agents)]);
            $data = curl_exec($ch);
        } else {
            if (!function_exists("file_get_contents")) {
                $this->error("The extension php_curl must be installed with PHP or function file_get_contents must be enabled.", 1);
                return false;
            } else {
                $data = @file_get_contents($url);
            }
        } if (empty($data)) {
            $this->error("An error occurred while retrieving the data.", 2);
            return false;
        }

        $data = @json_decode($data, 1);

        if (empty($data)) {
            $this->error("An error occurred when converting data.", 3);
            return false;
        } else {
            return $data;
        }
    }

from api-allocine-helper.

etn406 avatar etn406 commented on June 28, 2024

Salut tout le monde !
Merci croustibapt pour ton code, je viens d'apprendre qu'il y avait un problème mais qu'il y a aussi une solution, ça fait plaisir ^^
Je m'occuperai de la source dans les prochains jours, à moins que tu ne veuilles faire une "pull request" de ton code, croustibapt ?

from api-allocine-helper.

Arnaud69 avatar Arnaud69 commented on June 28, 2024

Bonjour à tous,

Eventuellement un rand sur l'IP du demandeur peut être le bienvenue, à savoir :

$ip=rand(0,255).'.'.rand(0,255).'.'.rand(0,255).'.'.rand(0,255);
$headers[] = "REMOTE_ADDR: $ip";
$headers[] = "HTTP_X_FORWARDED_FOR: $ip";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

from api-allocine-helper.

croustibapt avatar croustibapt commented on June 28, 2024

J'ai pas encore tout tester mais déjà les fonctions movie() et tvseries() fonctionnent.
Je pense que c'est mieux d'attendre encore un peu de voir si tout tient la route et en rajoutant les idées des uns et des autres. Tu feras le tri de ce que tu juges utile comme ça.

from api-allocine-helper.

croustibapt avatar croustibapt commented on June 28, 2024

Pour info : http://www.siteduzero.com/forum/sujet/probleme-avec-l-api-d-allocine

Ca bouge tous les jours en ce moment.

from api-allocine-helper.

davidgroult avatar davidgroult commented on June 28, 2024

Bonjour a tous,

Je n'arrive toujours pas à accéder à l'API d'allociné via le Helper.
J'ai aussi fait le tour du site du zéro que Croustibapt a précisé mais rien.

Si quelqu'un peut m'aider. Merci

from api-allocine-helper.

etn406 avatar etn406 commented on June 28, 2024

Plop tout le monde.
La dernière version est en ligne :)
Merci à la personne qui m'a envoyé sa version modifiée de "api-allocine-helper-2.2.php" (et qui fonctionne) par mail !

from api-allocine-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.