Php Facebook即时文章-内容不匹配
我正试图通过以下方式发布测试文章:Php Facebook即时文章-内容不匹配,php,facebook-instant-articles,Php,Facebook Instant Articles,我正试图通过以下方式发布测试文章: $the_html=” ,但无法使其与PHP一起工作 任何帮助都将不胜感激 您应该添加带有规则的文件并加载它 您应该添加带有规则的文件并加载它 谢谢你的帮助,伙计。Spasibo^^谢谢你的帮助,伙计。斯帕西博^^ $the_html = '<!doctype html> <html lang="en" prefix="op: http://media.facebook.com/op#"> <head> <meta
$the_html=”
,但无法使其与PHP一起工作
任何帮助都将不胜感激 您应该添加带有规则的文件并加载它
您应该添加带有规则的文件并加载它
谢谢你的帮助,伙计。Spasibo^^谢谢你的帮助,伙计。斯帕西博^^
$the_html = '<!doctype html>
<html lang="en" prefix="op: http://media.facebook.com/op#">
<head>
<meta charset="utf-8">
<meta property="op:markup_version" content="v1.0">
<link rel="canonical" href="http://myarticle">
<meta property="fb:article_style" content="default">
</head>
<body>
<article>
<header>
<h1> test title</h1>
<h2> test subtitle </h2>
<time class="op-published" dateTime="2016-06-20T08:00">June 17th 2016, 8:00 AM</time>
<time class="op-modified" dateTime="2016-06-20T08:00">June 17th 2016, 8:00 AM</time>
<p> Test test test </p>
</header>
</article>
</body>
</html>';
$fb = Client::create(
'APP_ID'
'APP_SECRET',
'ACCESS_TOKEN',
'PAGE_ID',
true //development env
);
$instant_article = InstantArticle::create();
$transformer = new Transformer();
libxml_use_internal_errors(true);
$document = new \DOMDocument();
$document->loadHTML($the_html);
libxml_use_internal_errors(false);
$transformer->transform($instant_article, $document);
$fb->importArticle($instant_article, true);
$rules = file_get_contents("instantArticlesModule/simple-rules.json", true);
$transformer = new Transformer();
$transformer->loadRules($rules);