使用curl / php从wordpress到tumblr双重发布

问题描述

| 我正在wordpress中使用插件,试图通过tumblr api传递帖子信息,也将其发布到我的tumblr博客。 一切正常,除了我在tumblr端出现了双重职位,我也不知道为什么。 函数getImgSrc($ postID) {         如果($ attachments = get_children(array(         \'post_type \'=> \'attachment \',         \'post_mime_type \'=> array(\'image \'),         \'numberposts \'=> 1,         \'post_status \'=> null,         \'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 =反序列化(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 =反序列化(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); } 任何指导将不胜感激。     

解决方法

        从您发布的代码中,我只能怀疑您收到了双重帖子,因为您已经复制了函数“ 0”。     

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...