【问题标题】:Double posting from wordpress to tumblr using curl/php使用 curl/php 从 wordpress 到 tumblr 双重发布
【发布时间】:2011-09-13 22:01:09
【问题描述】:

使用 wordpress 中的插件,我正在尝试通过 tumblr api 传递帖子信息以将其发布到我的 tumblr 博客。

除了我在 tumblr 端收到一个双重帖子之外,一切正常,我不知道为什么。

函数 getImgSrc($postID) { if ( $attachments = get_children( 数组( 'post_type' => '附件', 'post_mime_type' => 数组('图像'), 'numberposts' => 1, 'post_status' => 空, 'post_parent' => $post->ID ))); foreach ($attachments 作为 $attachment) { $t_source = wp_get_attachment_url($attachment->ID); } 返回$t_source; } //将博客发布到tumblr 函数 postBlogTumblr($postID) { $URLServer = "http://www.tumblr.com/api/write"; $t_post = get_post($postID); $tumblr_data = unserialize(get_option("tumblr")); $postdata['email'] = $tumblr_data['tumblr_login_email']; $postdata['password'] = $tumblr_data['tumblr_login_pass']; $postdata['type'] = "照片"; $postdata['source'] = getImgSrc($postID); $postdata['caption'] = $t_post->post_title; $postdata['state'] = "已发布"; $postdata = http_build_query($postdata); $result = datapost($URLServer,$postdata); } 函数 postBlogTumblr($postID) { $URLServer = "http://www.tumblr.com/api/write"; $t_post = get_post($postID); $tumblr_data = unserialize(get_option("tumblr")); $postdata['email'] = $tumblr_data['tumblr_login_email']; $postdata['password'] = $tumblr_data['tumblr_login_pass']; $postdata['type'] = "常规"; $postdata['title'] = $t_post->post_title; $postdata['body'] = $t_post->post_content; $postdata['state'] = "已发布"; $postdata = http_build_query($postdata); $result = datapost($URLServer,$postdata); }

任何指导将不胜感激。

【问题讨论】:

  • wordpress 有专门的网站,可以看看 wordpress.stackexchange.com
  • 您如何以及在哪里致电postBlogTumblr()?

标签: php wordpress api curl tumblr


【解决方案1】:

从您发布的代码中,我只能怀疑您收到了双重帖子,因为您复制了函数 postBlogTumblr()。

【讨论】:

    猜你喜欢
    • 2014-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-10
    • 2013-01-14
    • 2015-07-29
    • 1970-01-01
    • 2011-12-19
    相关资源
    最近更新 更多