I need to make a post in tumblr using the tumblr api.
Using the official tumblr php wrapper is not working, if i do a post method. When doing a get method it works fine i will get all the information i need.
I commented the get method. So you have a idea
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$tumblrId = $request->get('tumblr_id');
$table = DB::table('tumblr_tables')->where('id', $tumblrId);
$blogName = $request->get('title');
$body = $request->get('body');
$createdAt= $request->get('created_at');
$consumerKey = $table->value('consumer_key');
$consumerSecret = $table->value('consumer_secret');
$consumerToken= $table->value('tumblr_token');
$tumblrSecret = $table->value('tumblr_secret');
$data = [$body, $createdAt];
// Authenticate via OAuth
$client = new Client($consumerKey, $consumerSecret);
$client->setToken($consumerToken, $tumblrSecret);
// foreach ($client->getUserInfo()->user->blogs as $blog) {
// echo $blog->name . "
";
// }
$client->createPost($blogName, $data);
// return response(redirect(route('voyager.posts.index'))->with(['message' => "Your post created", 'alert-type' => 'success']));
return response('hello world');
}
I expect to see a new post on my tumblr page