Twitter oAuth callbackUrl - localhost development

后端 未结 17 1418
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 10:21

Is anyone else having a difficult time getting Twitters oAuth\'s callback URL to hit their localhost development environment. Apparently it has been disabled recently. http:

17条回答
  •  囚心锁ツ
    2020-11-27 11:00

    edit this function on TwitterAPIExchange.php at line #180

    public function performRequest($return = true)
    {
        if (!is_bool($return)) 
        { 
            throw new Exception('performRequest parameter must be true or false'); 
        }
    
        $header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:');
    
        $getfield = $this->getGetfield();
        $postfields = $this->getPostfields();
    
        $options = array( 
            CURLOPT_HTTPHEADER => $header,
            CURLOPT_HEADER => false,
            CURLOPT_URL => $this->url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_SSL_VERIFYHOST => false
        );
    
        if (!is_null($postfields))
        {
            $options[CURLOPT_POSTFIELDS] = $postfields;
        }
        else
        {
            if ($getfield !== '')
            {
                $options[CURLOPT_URL] .= $getfield;
            }
        }
    
        $feed = curl_init();
        curl_setopt_array($feed, $options);
        $json = curl_exec($feed);
        curl_close($feed);
    
        if ($return) { return $json; }
    }
    

提交回复
热议问题