(Ben orijinal yanıt gönderdi, ancak bunun yerine Zend_Gdata kullanmak için modifiye etmişti).
Burada blog kimliği alma için bir yöntemdir.
<?php
$user = 'username';
$pass = 'password';
// I have to admit, I would normally use the autoloader
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Feed');
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, 'blogger', null,
Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null,
Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client);
/**
* Get the blog ID
* @param string $feed URL to blog feed or blog name
* Example:
* - http://googleblog.blogspot.com/feeds/posts/default
*/
function getBlogId($gdClient, $feed)
{
// You could build the /feed/posts/default part yourself and just pass
// googleblog.blogspot.com:
// $feed = 'http://' . $feed . '/feeds/posts/default';
$query = new Zend_Gdata_Query($feed);
$feed = $gdClient->getFeed($query);
preg_match('/blog-([0-9]+)/', $feed->id->text, $match);
if (isset($match[1]))
{
return $match[1];
}
return false;
}
echo getBlogId($gdClient, 'http://sleeptalkinman.blogspot.com/feeds/posts/default');
Original answer
Eğer bilgi almak için çalışıyorsanız, o zaman sadece www.blogger.com parçayı değiştirin ve blogID görmezden gerekir. Örneğin, gelen tüm mesajları bulmaya çalışıyorsanız http://dailyvim.blogspot.com/ kullanmak istiyorsunuz:
http://dailyvim.blogspot.com/feeds/posts/default
Bunun yerine, normal URL, http://www.blogger.com/feeds/ [blogID] / ileti / default
Bu yöntem aynı zamanda çok uzun doğrulanmış kullanıcı kendisine yazma erişimi gibi, blogda yayınlamak için çalışabilir. Gerçi bu test mümkün olmamıştır.
Getting the blog ID
Aşağıdaki kullanarak yukarıdaki yemden blog kimliği alabilirsiniz:
$content = file_get_contents('http://sleeptalkinman.blogspot.com/feeds/posts/default');
preg_match('/<id>.*blog-([0-9]+)</id>/U', $content, $match);
print $match[1]; // Prints the blog ID
Getting post IDs for latest posts
Ayrıca yukarıda yem (ben yerine SimpleXML kullanacağız bu kez) en son mesaj alabilirsiniz:
$feed = simplexml_load_file('http://sleeptalkinman.blogspot.com/feeds/posts/default');
foreach ($feed->entry as $entry)
{
// I'm getting both the blog ID and post ID
preg_match('/blog-([0-9]+).*post-([0-9]+)/', $entry->id, $match);
print $match[2];
// Now you can use the following URL with the blogger API
$comment_feed_url = 'http://www.blogger.com/feeds/' . $match[1] . '/' . $match[2] . '/comments/default';
}