PHP Github Gist API создать массив содержимого не является строкой - PullRequest
1 голос
/ 28 июня 2019

все,

Я использую следующий API: https://github.com/akshay9/PHP-gist-API

Мой скрипт выглядит так:

include_once('includes/gist_api.php');
$gistAPI = new gistAPI('USERNAME', 'PASSWORD');

function create_githubgist($text, $title, $public = false) {

    global $gistAPI;

$filesArray = array("file1.txt" => array("content" => "Some Random Content"));

    $newGist = $gistAPI->createGist($filesArray, 'Create by TEST', $public);

    return $newGist;

}

$image_githubgist = create_githubgist('tEST', 'testtest', false);


/*var_dump($image_githubgist);*/

echo '' . var_export($image_githubgist, true) . '
';

Когда я запускаю скрипт, я получаю следующее сообщение:

'message' => 'Invalid request.

Для \ 'properties / content \', {"content" => "НекоторыеСлучайное содержимое "} не является строкой. ',' Documents_url '=>' https://developer.github.com/v3/gists/#create-a-gist',

Буду признателен за любую помощь.

РЕДАКТИРОВАТЬ СВОЙ: Я смог исправить это сам: https://github.com/BennyChange/PHP-gist-API

...