我有一个非常不寻常的问题。当我使用此脚本发布到 Blogger 时,例如,当我实际输入博客 ID 时,它可以完美运行
$blogID = '2542513707206115453';
uri
但是,当我让脚本自动抓取博客 ID 时,即使脚本抓取的数字与我输入的数字完全相同,它也会给我带来关于无效的错误。
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$blog = file_get_contents($link.'/feeds/posts/default');
preg_match('/tag:blogger.com,1999:blog-(.*?)-/', $blog, $blogID);
$blogID = rtrim($blogID[1], date("Y"));
$service = 'blogger';
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, null,
Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null,
Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client);
$entry = $gdClient->newEntry();
$entry->title = $gdClient->newTitle($title);
$entry->content = $gdClient->newContent($body);
$entry->content->setType('text');
$uri = 'http://www.blogger.com/feeds/'.$blogID.'/posts/default';
$createdPost = $gdClient->insertEntry($entry, $uri);
$idText = split('-', $createdPost->id->text);
$newPostID = $idText[2];
我不知道这怎么会发生,因为$blogID
无论是刮掉还是打字,它都是完全相同的数字。是的,我已经两次和三次检查了刮擦时它是完全相同的数字。任何帮助将非常感激。