duanjianfu1398 2019-08-02 14:12
浏览 112
已采纳

发布tumblr api禁止

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

  • 写回答

1条回答 默认 最新

  • douzhan2027 2019-08-02 15:00
    关注

    Thanks to @GrumpyCrouton

    $blogName should be the name of the blog you are posting to

    $client->createPost($blogName, $data);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog