键入时PHP变量读数不同

I am having a very unusual problem. When I use this script to post to Blogger it works perfectly when I actually type the blog ID in for example

$blogID = '2542513707206115453';

But when I have the script scrape the Blog ID automatically it gives me errors talking about an invalid uri even though the script is scraping the exact same number as I am typing.

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];

I have no idea how this could even happen since the $blogID is the exact same number whether scraped or whether typed. And yes I have double and triple checked that when scraped it is the exact same number. Any help would be much appreciated.

What is the point of this call?

$blogID = rtrim($blogID[1], date("Y"));

The 2nd option in rtrim specifies which characters should be trimmed from the end of the string. Since you're using a date (2013 at present), you're trying to eliminate ANY 2, 0, 1 and 3 chars from the string.

That means, given your

$blogID = '2542513707206115453';

you'll actually end up with

$blogID = '254251370720611545';
                             ^--- see? no 3

which is NOT the same number