source/php/Module/Social/Feed.php
public function getTwitterHashtag()
    {
        $access_token = $this->getTwitterAccessToken();

        if (isset($access_token->errors[0])) {
            return $access_token->errors[0];
        }

        $endpoint = 'https://api.twitter.com/1.1/search/tweets.json';
        $data = array(
            'access_token'     => $access_token,
            'q'                => urlencode('#' . $this->args['query']),
            'count'            => $this->args['length'],
            'exclude_replies'  => true,
            'include_rts '     => false,
            'result_type'      => 'recent',
            'lang'             => 'sv'
        );

        // Request headers
        $headers = array(
            "GET /1.1/search/tweets.json" . http_build_query($data) . " HTTP/1.1",
            "Host: api.twitter.com",
            "User-Agent: jonhurlock Twitter Application-only OAuth App v.1",
            "Authorization: Bearer " . $access_token
        );

        // Curl
        $curl = new \Modularity\Helper\Curl();
        $tweets = $curl->request('GET', $endpoint, $data, 'JSON', $headers);

        return json_decode($tweets)->statuses;
    }
public function getTwitterHashtag()
    {
        $access_token = $this->getTwitterAccessToken();

        if (isset($access_token->errors[0])) {
            return $access_token->errors[0];
        }

        $endpoint = 'https://api.twitter.com/1.1/search/tweets.json';
        $data = array(
            'access_token'     => $access_token,
            'q'                => urlencode('#' . $this->args['query']),
            'count'            => $this->args['length'],
            'exclude_replies'  => true,
            'include_rts '     => false,
            'result_type'      => 'recent',
            'lang'             => 'sv'
        );

        // Request headers
        $headers = array(
            "GET /1.1/search/tweets.json" . http_build_query($data) . " HTTP/1.1",
            "Host: api.twitter.com",
            "User-Agent: jonhurlock Twitter Application-only OAuth App v.1",
            "Authorization: Bearer " . $access_token
        );

        // Curl
        $curl = new \Modularity\Helper\Curl();
        $tweets = $curl->request('GET', $endpoint, $data, 'JSON', $headers);

        return json_decode($tweets)->statuses;
    }
public function getTwitterHashtag ( ) { $ access_token = $ this -> getTwitterAccessToken ( ) ; if ( isset ( $ access_token -> errors [ 0 ] ) ) { return $ access_token -> errors [ 0 ] ; } $ endpoint = 'https://api.twitter.com/1.1/search/tweets.json' ; $ data = array ( 'access_token' => $ access_token , 'q' => urlencode ( '#' . $ this -> args [ 'query' ] ) , 'count' => $ this -> args [ 'length' ] , 'exclude_replies' => true , 'include_rts ' => false , 'result_type' => 'recent' , 'lang' => 'sv' ) ; // Request headers $ headers = array ( "GET /1.1/search/tweets.json" . http_build_query ( $ data ) . " HTTP/1.1" , "Host: api.twitter.com" , "User-Agent: jonhurlock Twitter Application-only OAuth App v.1" , "Authorization: Bearer " . $ access_token ) ; // Curl $ curl = new \ Modularity \ Helper \ Curl ( ) ; $ tweets = $ curl -> request ( 'GET' , $ endpoint , $ data , 'JSON' , $ headers ) ; return json_decode ( $ tweets ) -> statuses ; }
Get Twitter hashtag
@return object Feed data
Get Twitter hashtag