2

Tumblr の API を使用する PHP スクリプトを開発しています。「テキスト」を投稿するとすべて正常に動作しますが、「引用」投稿では「Bad Request」エラーが発生します。Composerを使用して、 https://github.com/tumblr/tumblr.phpから「tumblr/tumblr」リポジトリを取得します。

これは私のPHPスクリプトです:

<?php

require 'vendor/autoload.php';

$consumer_key = 'KEY';
$consumer_secret = 'SECRET';
$token = 'TOKEN';
$token_secret = 'SECRET';
$blog = 'BLOG';

$client = new Tumblr\API\Client($consumer_key, $consumer_secret, $token, $token_secret);

#$options = array('type' => 'text', 'title' => 'Title', 'body' => 'Body', 'tags' => 'Test');
$options = array('type' => 'quote', 'text' => 'Text', 'source' => 'Source', 'tags' => 'Test');

try{
    $res = $client->createPost($blog, $options);
}
catch(Exception $e){
    print "ERROR: ".$e->getMessage()."\n";
    exit(1);
}

どうすればこれを修正できますか?

4

1 に答える 1