WP-API / client-cli

65 stars 20 forks source link

Error: Class `WPAPI` not found... #20

Open domenic95 opened 10 years ago

domenic95 commented 10 years ago

I am getting an error when running this command:

wp --require=client.php api oauth1 connect http://example.com --key=4ugulKVfFNka --secret=ozGESz8v4FNdmpoCfPw9gNqk9qbc29IAMujaaSPxapAduiml

PHP Fatal error: Class 'WPAPI' not found in /home/dschiera/wp-cli/client-cli/lib/commands/base.php on line 29

I am using a different url of course. The Wordpress installation I'm posting to has JSON REST API and OAuth Server Plugins installed. I was able to authenticate. I used composer install, and composer update. I'm running PHP 5.5.10.

bobbingwide commented 10 years ago

Having overcome the problem in issue #18 I also suffered this PHP Fatal Error when performing "wp api user list".

My workaround was to add the following code to the start of client-cli/client.php

use WPAPI;
require_once __DIR__ . '/vendor/wp-api/client/library/WPAPI.php' ;
WPAPI::register_autoloader();
Giambapisasale commented 9 years ago

thanks bobbingwide, great job!

cehwitham commented 9 years ago

Thanks @bobbingwide