Wallogit.com
2017 © Pedro Peláez
Api to call sortechs website.
This repository contains the open source PHP SDK that allows you to access the Sortechs automation app from your PHP app., (*1)
The Sortechs PHP SDK can be installed with Composer. Run this command:, (*2)
composer require sortechs/sdk
require_once '../src/Sortechs/autoload.php';
$data = [
'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$section = $so->getSections($token);
$news = $so->app->news([
'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api *Required or sectionName
'sectionName'=>'News',//*Required or sectionId
'title'=>'XXXX XXXX ',//*Required
'article'=>'XXX XXX - XXX',//*Required
'url'=>'https://www.XXXX.com/news.html?id=XXXXXXXX',//*Required
'newsId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', /*id from your DATABASE , Like 1000 *Required */
'options'=>[] /* Optional*/
]);
$response = $so->AddNews($token,$news);
print_r($response);
require_once '../src/Sortechs/autoload.php';
$data = [
'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
/** video */
/*$media = $so->app->media([
[
'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.mp4',
'caption'=>null,
'type'=>'video'
]
]);*/
$media = $so->app->media([
[
'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
'caption'=>null,
'type'=>'image'
],
[
'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
'caption'=>null,
'type'=>'image'
],
[
'url'=>'https://www.XXXXXXXXXXXXXXXXXX.com/css/trolltunga.jpg',
'caption'=>null,
'type'=>'image'
]
]);
$news = $so->app->news([
'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api *Required or sectionName
'sectionName'=>'News',//*Required or sectionId
'title'=>'XXXX XXXX ',//*Required
'article'=>'XXX XXX - XXX',//*Required
'url'=>'https://www.XXXX.com/news.html?id=XXXXXXXX',//*Required
'newsId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', /*id from your DATABASE , Like 1000 *Required */
'options'=>[] /* Optional*/
]);
$response = $so->AddNewsWithMedia($token,$news,$media);
$data = [
'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$data_section = new \Sortechs\request\Section(['title'=>'XXXX']);
$data = $so->addSection($token,$data_section);
require_once '../src/Sortechs/autoload.php';
$data = [
'app_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'app_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXXXXXXXXX',
];
/**@var $so \Sortechs\Sortechs **/
$so = new \Sortechs\Sortechs($data);
$token = new Sortechs\Authentication\AccessToken($so->generateAccessToken());
$tags = $so->app->tags([
//'sectionId'=>'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx', //id from your api
'sectionName'=>'News',
'tags'=>[
'tag',
'tag X',
'tag X',
'tag X',
]
]);
$response = $so->AddTags($token,$tags);
Complete examples are available here., (*3)