J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 802 forks source link

Fatal error: Uncaught Error: Call to a member function buildOauth() on null #293

Closed birdbreath closed 3 years ago

birdbreath commented 3 years ago

Returns:

Fatal error: Uncaught Error: Call to a member function buildOauth() on null. .....line 32

Any idea why?

Screen Shot 2020-10-05 at 5 34 01 PM copy

idea why?

_Originally posted by @birdbreath in https://github.com/J7mbo/twitter-api-php/issue_comments/703965687_

birdbreath commented 3 years ago

added: echo "$twitter->buildOauth($url, $method)";

result: (https://upload.twitter.com/1.1/media/upload.json, POST)

J7mbo commented 3 years ago

Hi. I don't think anyone is going to look at the picture of your code and type it out character by character so they can test it.

So others can help you better, it might be better to paste the actual code into the box. The github docs can help you format your code here.

J7mbo commented 3 years ago

However, I can see right from the get that you have not initialised the $twitter variable to anything when you try and use it for the first time. It doesn't exist yet. You need to create it.

Call to a member function buildOauth() on null.

You're trying to call buildOauth on null, something that doesn't exist. You want to be calling that on something that does exist.

birdbreath commented 3 years ago

Great catch. I totally missed it. It worked perfectly. Thanks

birdbreath commented 3 years ago

And in there future I will be including text samples