Closed andreideveloper closed 6 years ago
Did you push the /vendor
directory up to your server? If so, could you share any error messages you are getting?
yes I did
Could you share what was on line 21 in testapi.php
?
My initial thinking is that maybe you're using the wrong namespace. When you create an instance, does your code look something like this?
require_once __DIR__ . '/vendor/autoload.php';
ultracart\v2\Configuration::getDefaultConfiguration()->setApiKey('x-ultracart-simple-key', 'YOUR_KEY_GOES_HERE');
$client = new GuzzleHttp\Client(['verify' => false, 'debug' => false]);
$api_instance = new ultracart\v2\api\AutoOrderApi(
$client,
ultracart\v2\Configuration::getDefaultConfiguration(),
new ultracart\v2\HeaderSelector("2016-10-01")
);
thanks for responding
I just copied the code in the "getting started" this is the code
<?php
// for testing and development only
set_time_limit(3000);
ini_set('max_execution_time', 3000);
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
<?php
// initialization code
require_once 'vendor/autoload.php';
$simple_key = '4256aaf6dfedfa01582fe9a961ab0100216d737b874a4801582fe9a961ab0100';
ultracart\v2\Configuration::getDefaultConfiguration()->setApiKey('x-ultracart-simple-key', $simple_key);
$client = new GuzzleHttp\Client(['verify' => true, 'debug' => false]);
$config = ultracart\v2\Configuration::getDefaultConfiguration();
$headerSelector = new \ultracart\v2\HeaderSelector(/* leave null for version tied to this sdk version */);
$auto_order_api = new ultracart\v2\Api\AutoorderApi
(
$client,
$config,
$headerSelector
);
the code in line 21 is this
$auto_order_api = new ultracart\v2\Api\AutoorderApi
(
$client,
$config,
$headerSelector
);
Try replacing this...
ultracart\v2\Api\AutoorderApi
..with this...
ultracart\v2\api\AutoOrderApi
still has the error I don't know why it can't read the autoorderapi.php but can read the
$headerSelector = new \ultracart\v2\HeaderSelector(/ leave null for version tied to this sdk version /);
oh I'm really sorry it's working using
ultracart\v2\api\AutoOrderApi
i did not notice the api can be small letter thanks!
I Installed the PHP SDK via composer on my local computer it's working fine but when I move it on our live server it throws an error
atal error: Uncaught Error: Class 'ultracart\v2\Api\AutoorderApi' not found in /path_to_public_html/pingbackpixel/testapi.php:21 Stack trace: #0 {main} thrown in /path_to_public_html/pingbackpixel/testapi.php on line 21
I see the AutoOrderApi.php inside vendor/UltraCart/rest_api_v2_sdk_php/lib/api/AutoOrderApi.php