Twitter Search API 1.1返回401

I'm trying to do something very simple, find a Twitter share count for a given url. But with this new API, it has been rather difficult.

I'm writing this in PHP and I'm using the abraham/twitteroauth API.

At first I was using a url like this...

$tweets = $twitter->get("https://api.twitter.com/1.1/search/tweets.json");

as is show in the documentation here https://dev.twitter.com/rest/reference/get/search/tweets

However that continually resulted in 404's. So I changed the structure of my code according to this post Twitter API returning Error: 34 (404)

But now all I'm getting is 401's. That's Twitters error code 32, "Could not authenticate you."

And yes I've checked and double checked all my tokens and secrets. I've also tried things like adding a value to the callback url field.

Below is my code...

case 'twitter':
        $consumerKey = '###';
        $consumerSecret = '###';
        $oauthToken = '###';
        $oauthTokenSecret = '###';

        $twitter = new TwitterOAuth($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);

        $tweets = $twitter->get('search/tweets', ['q' => 'post_url_goes_here']);

        $count = "I'll figure out how to sort this data later";

        $response[$service] = $count ? $count : 0;

        break;

Anyone else run into this problem?

Thanks!