向Wordpress发送卷曲帖子会删除我的<video> <source />标记

时间:2016-04-14 19:34:09

标签: php wordpress curl oauth html5-video

我目前正从我的软件发布到Wordpress。到目前为止,通过我的帖子传递任何文本或html标签都没有任何问题。由于某些原因,我在<source>代码中丢失<video>标记,只要它发布到Wordpress。

以下是我试图传递给Wordpress的内容。

<video controls="controls" height="1440" id="248" poster="" width="1920"><source src="http://virpublisher.info/wp-content/uploads/2016/04/GOPR0241.mp4" type="video/mp4" />Your browser does not support the video tag</video>

以下是Wordpress发布的结果

<video controls="controls" height="1440" id="248" poster="" width="1920">Your browser does not support the video tag</video>

我做了一些日志记录,以找出丢失<source>标记的确切位置。在我下面的PHP代码中,您可以看到我为$qParams调试的位置。在下面的日志记录中,您可以看到<source>中仍然可以看到[content]。但是,每当我开始使用这行代码<source>时,我似乎都会丢失curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($qParams));标记。您可以在===RESP DEBUG===下的日志记录中看到此说明。谁能帮我理解为什么会这样?

摘自我的PHP代码:

$qParams    = array(
                'access_token' => $at,
                'title'=>$title,
                'content'=>$content,
                'excerpt'=>$excerpt,
                'status'=>$wpStatus,
                'categories'=>$wpCategories,
                'featured_media'=>$wpFeaturedMediaId);

Util::error_log('====ARTICLE POST PARAMS===');
Util::debugArr($qParams);

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$postUrl);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($qParams)); //I seem to lose my <source> tag here
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$resp = curl_exec($ch);
curl_close ($ch);

Util::error_log('====RESP DEBUG===');
Util::debugArr($resp);

$resp = Util::jsonDecode($resp);

日志记录:

[14-Apr-2016 14:16:51 America/Chicago] INFO: ====ARTICLE POST PARAMS===
[14-Apr-2016 14:16:51 America/Chicago] ==== START debugArr: ====
[14-Apr-2016 14:16:51 America/Chicago] Array(
[access_token] => fjeter5hjhiyezhrvhcy7o1mogavbmadoos5n745
[title] => Mountain Biking
[content] => <video controls="controls" height="1440" id="248" poster="" width="1920"><source src="http://virpublisher.info/wp-content/uploads/2016/04/GOPR0241.mp4" type="video/mp4" />Your browser does not support the video tag</video>
[excerpt] => 
[status] => draft
[categories] => Array
    (
    )
[featured_media] => 174
)
[14-Apr-2016 14:16:51 America/Chicago] ==== END debugArr: ====


[14-Apr-2016 14:16:53 America/Chicago] INFO: ====RESP DEBUG===
[14-Apr-2016 14:16:53 America/Chicago] ==== START debugArr: ====
[14-Apr-2016 14:16:53 America/Chicago] {"id":286,"date":"2016-04-14T19:16:53","date_gmt":null,"guid":{"rendered":"http:\/\/virpublisher.info?p=286&#038;preview_id=286","raw":"http:\/\/virpublisher.info?p=286&#038;preview_id=286"},"modified":"2016-04-14T19:16:53","modified_gmt":"2016-04-14T19:16:53","password":"","slug":"mountain-biking-2","status":"draft","type":"post","link":"http:\/\/virpublisher.info?p=286&preview_id=286","title":{"raw":"Mountain Biking","rendered":"Mountain Biking"},"content":{"raw":"<video controls=\"controls\" height=\"1440\" id=\"248\" poster=\"\" width=\"1920\">Your browser does not support the video tag<\/video>\n","rendered":"<p><video controls=\"controls\" height=\"1440\" id=\"248\" poster=\"\" width=\"1920\">Your browser does not support the video tag<\/video><\/p>\n"},"excerpt":{"raw":"","rendered":"<p>Your browser does not support the video tag<\/p>\n"},"author":1,"featured_media":174,"comment_status":"closed","ping_status":"open","sticky":false,"format":"standard","categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/posts\/286"}],"collection":[{"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"https:\/\/api.w.org\/featuredmedia":[{"embeddable":true,"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/media\/174"}],"https:\/\/api.w.org\/attachment":[{"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/media?parent=286"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/virpublisher.info\/wp-json\/wp\/v2\/tags?post=286"}]}}

0 个答案:

没有答案