I'm trying to connect to an API, I'm a front end dev, not too familiar with server side & php. Would love your help.
This is the repository - https://github.com/bigcommerce/bigcommerce-api-php I'm not using composer.
They say there -
To use the API client in your PHP code, ensure that you can access Bigcommerce\Api in your autoload path
I've been trying to figure out how to do that, but I just can't figure it out.
This is the code that i wrote -
<?php
/**
* Created by PhpStorm.
* User: Alex
* Date: 12/15/14
* Time: 9:29 PM
*/
require '../bigcommerce.php';
//echo realpath('../bigcommerce/api/client');
use ֿֿBigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array(
'store_url' => '', //my store url
'username' => 'admin',
'api_key' => '' //my api key
));
$ping = Bigcommerce::getTime();
if ($ping) echo $ping->format('H:i:s');
$products = Bigcommerce::getProducts();
foreach($products as $product) {
echo $product->name;
echo $product->price;
}
?>
I use:
spl_autoload_register(function ($class) {
include $class . '.php';
});
I'm sorry, but i'm finding it quite hard to explain the question. I need to include classes with autoload but it doesn't work, i have no idea why. It keeps telling me that failed to open stream.