问题
in cake php 1.3 in view ctp i have follow code:
$url = 'http://example.com/exmp/explus/books/view/'.$book['Book']['id'];
echo $this->Html->meta(array('property' => 'fb:app_id', 'content' => '*******'),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:type', 'content' => 'book'),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:url', 'content' => $url ),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:title', 'content' => $book['Book']['title']),'',array('inline'=>false));
echo $this->Html->meta(array('property' => 'og:description', 'content' => $book['Book']['title']),'',array('inline'=>false));
$imgurl = '../image/'.$book['Book']['id'];
echo $this->Html->meta(array('property' => 'og:image', 'content' => $imgurl ),'',array('inline'=>false)); ?>
and it gives the following error when i am posting it'
{
"error": {
"message": "(#3502) Object at URL http://example.com/exmp/explus/books/view/234' has og:type of 'website'. The property 'book' requires an object of og:type 'book'. ",
"type": "OAuthException",
"code": 3502
}
}
is any one know how to solve it?
回答1:
This issue can occur if your page is restricted for logged in users or has some sort of session logic.
You can use the debug tool from this link :
http://developers.facebook.com/tools/debug
In that link you can give your url (http://example.com/exmp/explus/books/view/234) in the "Input URL, Access Token, or Open Graph Action ID"
Field.
After that on clicking the debug button if you are able to see the values for fb:app_id,og:url,og:type,og:title
, this issue would not occur.
Else you can check the "URLs"
section at the bottom of the page and click the "See exactly what our scraper sees for your URL"
link.On clicking the link you can see the html code of your site in the browser. That will help you to debug the issue.
回答2:
BP RAM is right, if you follow his steps you should be able to locate the problem. (I would upvote if I could; not enough reputation.)
I would like share my experience to elaborate. I encountered the same problem recently. Facebook keeps on ignoring all the meta tags and I get the same #3502 error.
I finally used Facebook Debug Tool > "Scraped URL" to inspect my code. This tool shows you exactly what Facebook crawler sees.
I noticed there are php errors mixed in with my HTML code. These errors never appeared in the source code for IE, FF or Chrome. In my case, it was to do with my browser detection code. Facebook's crawler's user_agent was not on my list and caused my detection code to generate error messages which broke the HTML markup. I fixed my function and everything started to work again!
I suggest you check your website with: http://developers.facebook.com/tools/debug/og/echo?q=YOUR_WEBSITE_URL_HERE
(Or use https://developers.facebook.com/tools/debug , type in your URL and press "Scraped URL" at the bottom of the page.)
Check whether there are garbage codes mixed into the <head></head> section. If there is, Facebook will fail to parse the meta tags.
来源:https://stackoverflow.com/questions/10135323/facebook-open-graph-meta-property-ogtype-of-website-the-property-object-nam