Skip to content

how can i create a CronJob ? #39

@kimannou

Description

@kimannou

Hi !
how can i create a CronJob ? i nfact i changed the get_products.php so it became like this :
`session_start();

require __DIR__.'/vendor/autoload.php';
use phpish\shopify;

require __DIR__.'/conf.php';
$shopify = shopify\client(
	'myshop.myshopify.com',
	SHOPIFY_APP_API_KEY, 
	'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
try
{
	# Making an API request can throw an exception
	$products = $shopify('GET /admin/products.json', array('published_status'=>'published'));
	echo '<pre>';print_r($products);echo '</pre>';die;
}`

in fact this is working perfectly when i call it from an url in browser and it show the perfect result, but when i execute this code in a commmand line using :
php get_products.php
it shows this error :
`
~/www/shopify $ php get_products.php
phpish\shopify\CurlException: [7] in /home/cmsservixi/www/shopify/get_products.php on line 19Array
(
[method] => GET
[uri] => https://myshop.myshopify.com/admin/products.json
[query] => Array
(
[published_status] => published
)

[headers] => Array
    (
        [X-Shopify-Access-Token] => xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        [content-type] => application/json; charset=utf-8
    )

[payload] =>

)
Array
(
)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions