Php 如何将google表单电子表格数据插入wordpress数据库?
我搜索过谷歌并实现了这段代码,但它给出了 警告:DOMDocument::loadXML():开始和结束标记不匹配:第36行的/home/etplpm/public_html/netsamningar/wp content/thestory/template-login.php中的链接第2行和head-in实体第94行。 我已经根据我的文档更改了Url和密钥,但找不到任何合适的解决方案Php 如何将google表单电子表格数据插入wordpress数据库?,php,wordpress,curl,Php,Wordpress,Curl,我搜索过谷歌并实现了这段代码,但它给出了 警告:DOMDocument::loadXML():开始和结束标记不匹配:第36行的/home/etplpm/public_html/netsamningar/wp content/thestory/template-login.php中的链接第2行和head-in实体第94行。 我已经根据我的文档更改了Url和密钥,但找不到任何合适的解决方案 $key = "...key..."; $url = "https://docs.google.
$key = "...key...";
$url = "https://docs.google.com/spreadsheets/d/...key.../pubhtml";
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// grab URL and pass it to the browser
$google_sheet = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
$doc = new DOMDocument();
$doc->loadXML($google_sheet);
$nodes = $doc->getElementsByTagName("cell");
if($nodes->length > 0)
{
foreach($nodes as $node)
{
// 2nd row is the email row.
if ($node->getAttribute("row") == 2)
{
if (eregi("^[\.\+_a-z0-9-]+@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $node->nodeValue) )
{
mail($node->nodeValue, "Mail Subject", "Mail Message.", "From: email@yourdomain.com");
}
}
}
}