Closed vespino closed 8 years ago
none OOP as in PHP4 ?
Like in functions instead of classes. I understand the way classes work (like I said I using an older version that has been working great for me the last couple of years) but the current version is a bit to much to understand. I'm looking to update because I want to be able to upload media.
Pretty sure that would require a different library altogether. There is no easy way to turn a Class-based library into a function-based one.
Like I said, I know how to implement classes, but not how to write them. This however seems to require another approach, not?
What I'm looking for is an (working) example like this:
<?php
include 'Config.php';
include 'include 'src/TwitterOAuth.php';
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret);
$statuses = $connection->get("search/tweets", ["q" => "twitterapi"]);
?>
Now this results in something like the following error:
Fatal error: Uncaught Error: Class 'TwitterOAuth' not found in C:\server\www\opolo.nl_emt2\index.php:18 Stack trace: #0 {main} thrown in C:\server\www\opolo.nl_emt2\index.php on line 18
Hope someone can help me.
Think I found the solution:
<?php
require "config.php";
require "twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
$connection=new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_COOKIE['oauth_token'], $_COOKIE['oauth_token_secret']);
$content = $connection->get("account/verify_credentials");
?>
Now only to fix this:
stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Your credentials do not allow access to this resource [code] => 220 ) ) )
Probably the wrong credentials but I can figure this out. Everyday a new challenge :)
find me on Twitter. Let's make this happen.
I already did :)
Hi,
Is there a simple example of how to implement this project? I'm coming from an older version which only has to be included and away we go but simply including the files "Config.php" and "TwitterOAuth.php" results in classes that can't be found and all kinds of errors that go above my head :(
Sorry for not beeing an OOP developer, but I simply are not getting around to it and I'm sticking to WordPress :)