Noobie bigcommerce API 连接 [英] Noobie bigcommerce API connection
问题描述
很抱歉问这个菜鸟问题,但我只是想知道我至少可以连接到我的 bigcommerce 商店并通过 PHP 或 curl 脚本查询它的过程.
如果有人可以帮助我提供简单的说明.即下载 bigcommerce php 脚本,安装,在用户上生成 API,安装 wamp 或其他一些 php mac 应用程序粘贴到这里等等等等我将永远感激.
我一直在阅读和阅读,但很明显遗漏了一些东西,因为我无法从开发者大型商业功能的操场部分产生任何东西,也不知道从哪里开始.
差点忘了说我用的是 Mac,如果这有区别的话
谢谢
安德鲁
1) 要求
PHP 5.3 或更高版本启用 cUrl 扩展
2) 创建文件夹 wamp/www/bigcommerceDemo 并下载 https://github.com/bigcommerce/bigcommerce-api-php/archive/master.zip 在其中.
3) 使用 composer install 命令安装 composer
4) 在 bigcommerceDemo 文件夹中创建 index.php 文件表示您的项目文件夹
index.php 文件:-<?php需要'供应商/自动加载.php';使用 Bigcommerce\Api\Client 作为 Bigcommerce;Bigcommerce::configure(数组('store_url' =>'https://xyz-com.mybigcommerce.com/','用户名' =>'行政','api_key' =>'dummy92f6fd3df7f140719c1889e78d9c026999p'));Bigcommerce::verifyPeer(false);$ping = Bigcommerce::getTime();如果($ping){//echo $ping->format('H:i:s');}Bigcommerce::failOnError();尝试 {$orders = Bigcommerce::getOrders();} catch(Bigcommerce\Api\Error $error) {echo $error->getCode();echo $error->getMessage();}$products = Bigcommerce::getProducts();//echo '';打印_r($产品);出口;echo '';foreach($products as $product) {//print_r($product);回声 $product->name .'---------';//echo $product->price .'
';}
5) 运行 localhost/bigcommerceDemo :此文件显示所有产品.
Sorry for the noobie question but I just wanted to know the process by which I could at least connect to my bigcommerce store and query it via a PHP or curl script.
If someone could help me with simple instructions. i.e download bigcommerce php script, install , generate API on user, install wamp or some other php mac app paste into here blah blah blah I would be eternally grateful.
I have been reading and reading and just obvioulsy missing something as I cant gereneate anything out of the playground section of developer big commerce functionality and dont know where to go from here.
Nearly forgot to mention I am on a mac if that makes a difference
Thanks
Andrew
1) Requirements
PHP 5.3 or greater
cUrl extension enabled
2) Create Folder wamp/www/bigcommerceDemo and Download https://github.com/bigcommerce/bigcommerce-api-php/archive/master.zip in it.
3) Install composer with composer install command
4) Create index.php file in bigcommerceDemo folder means your project folder
index.php File :-
<?php
require 'vendor/autoload.php';
use Bigcommerce\Api\Client as Bigcommerce;
Bigcommerce::configure(array(
'store_url' => 'https://xyz-com.mybigcommerce.com/',
'username' => 'admin',
'api_key' => 'dummy92f6fd3df7f140719c1889e78d9c026999p'
));
Bigcommerce::verifyPeer(false);
$ping = Bigcommerce::getTime();
if ($ping) {
//echo $ping->format('H:i:s');
}
Bigcommerce::failOnError();
try {
$orders = Bigcommerce::getOrders();
} catch(Bigcommerce\Api\Error $error) {
echo $error->getCode();
echo $error->getMessage();
}
$products = Bigcommerce::getProducts();
//echo '<pre>'; print_r($products); exit;
echo '<pre>';
foreach($products as $product) {
//print_r($product);
echo $product->name . '---------';
//echo $product->price . '<br>';
}
5) Run localhost/bigcommerceDemo : This file display all products.
这篇关于Noobie bigcommerce API 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!