18 Jun 06-10
Official PHP adapter for Shopify API
We’re happy to announce the open source release of an official PHP adapter for the Shopify API. It’s got all the bells and whistles of its Ruby counterpart to help you create great applications for release in the Shopify App Store.
Forget having to write installation & authentication code yourself. Generating an installation link and redirecting the merchant to a screen asking for permission to access their shop’s data is now just these two lines:
$api = new Session('mystore.myshopify.com', '', 'YOUR_API_KEY', 'YOUR_SECRET');
header("Location: " $api->create_permission_url());
After the merchant gives your app permission to access their data, Shopify redirects the user to the return URL you set up for your app, along with their shop name, token and signature.
Finish authentication by passing the shop name, token, and signature into the Session:
$shop = $_GET['url']; $token = $_GET['t']; $api = new Session($shop, $token, 'YOUR_API_KEY', 'YOUR_SECRET');
That’s it! Now that your application’s been installed, you’re ready to make API calls to the merchant’s shop.
Here’s an example that prints the title of each product:
$storeProducts = $api->product->get();
foreach($storeProducts as $product) {
echo $product['title'].'<br />';
}
You can also request a specific product by passing its product id to the product
get()method:
$aProduct = $api->product->get(1234567); echo $aProduct['title'];
To create a new product (if your application has write permissions), you can use the product
create()method by passing fields you would like your new product to have:
$fields = array('title' => 'My New Product');
$api->product->create($fields);
To update a product (if your application has write permissions), you can use the product
modify()method by passing the product id and the fields you would like to modify:
$fields = array('title' => 'My Updated Title');
$api->product->modify(1234567, $fields);
Download and try the new PHP API for yourself by going to its GitHub repository. Forks and feature requests are encouraged.
Give us, the Shopify Developers, a shout in the developer forums if you need a hand or want to pass on a compliment to William Lang, one of our newest developers and the man behind this library.
Comments
June 18, 2010 09:00AM EDT
Outstanding! Thank you! I will be putting this to use today!!
June 18, 2010 09:00AM EDT
Hi I am not real sure as to what this new development can do for my store. Would it be possible to give some incite as to the benefits of have this in my store front?
June 18, 2010 09:00AM EDT
Walt,
The benefits to you are more indirect as a merchant. Having an official API client for PHP developers makes it easier for PHP developers to create applications that you can later install in your store.
June 18, 2010 09:00AM EDT
Nice addition, thanks!!
June 18, 2010 09:00AM EDT
Nice! I’m just finishing up another Shopify store, and can’t tell you how impressed I am with its functionality. This API looks very clean. Look forward to pumping some apps into the app store.
June 18, 2010 09:00AM EDT
I’m looking forward to developing some apps for Shopify. Never got around to learning Ruby :-)
May 31, 2011 10:17AM EDT
paradise игра
сталкер видео из игры
тигран петросян
игра со смертью
бета тест онлайн игры
total control игра скачать
паниграхи прадош кумар
софт и игры для кпк
не играет интернет радио
n-gage игры
игры русалки
каллиграфические буквы
игра ведьма
тигры обои
маджонг бесплатно играть
полиграфсервис ставрополь
игра линии скачать бесплатно
азартные флэш игры
пв игра
игра виртуальный аквариум
bmx игры
игра паровозики
игра сокровища монтесума
sony ericsson w300i игры бесплатно
не проигрывает видео вконтакте
фильм иллюзия игры
устами младенца игра
alawar игры
игра территория тьмы
стратиграфический кодекс
сибирь играть
хип-хоп игры
samsung g600 игры
полоса полиграфия
проигрывание dvd
fantasy wars игра
сегодня ты играешь трэш
larry игра
siemens m65 игры
яой игра скачать
online игры
игра мортал комбат
heretic игра
обмен ссылками игры
игра сега
100 к 1 игра
euro 2008 игра скачать
игры пузыри
эмиграция в сша
флеш проигрыватель для сайта
w950 игры