Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
616 views
in Technique[技术] by (71.8m points)

php - Facebook - Error parsing input URL, no data was cached, or no data was scraped

After research I found that alot of people facing the same issue. But so far I don't solution, this happened after I switch my server to linode.com

lets take an example. www.acemark2u.com is one of the website hosted under the linode server, when I try to debug in https://developers.facebook.com/tools/debug/og/object/, it just couldn't fetch the scrape information correctly, and if I try with one of the page www.acemark2u.com/about-us, it just show me the error "Error parsing input URL, no data was cached, or no data was scraped."

weird things happen. when I try to debug using ip address 106.187.35.114/~acemark2 everything goes smooth. fetching nicely, no error 404 for pages.

I suspect it might caused by "gethostbyaddr" function (ref: http://www.gearhack.com/Forums/DisplayComments.php?file=Computer/Network/Internet/Preventing_Your_Web_Server_From_Blocking_Facebook_Share) but so far I don't have solutions.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For people experiencing the same issue but for different causes, I discovered a few interesting things about how Facebook "scrapes" pages, checking the logs of the server while doing some trials.

First of all: if you never tried to share a page with FB, FB never tried to scrape it, and it will not try to do so if you only put the url in the Debug tool. That's the first reason because you get the error: it just states that FB has no information on the page, you must "force" it to scrape the page.

The first time you try to share a page, FB scrapes it (asks your server the first 40k of the page and analyse the opengraph tags). What can happen is that you do not see the image: Facebook Share Dialog does not display thumbnails one first load

The reason is that FB behind the scenes is still scraping your page and caching the image. The next time, in fact, you have also the image. How to solve it? Pre caching: https://developers.facebook.com/docs/sharing/best-practices#precaching

or simply add

<meta property="og:image:width" content="450"/>
<meta property="og:image:height" content="298"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...