Posting to Facebook through Graph API - HTML Blog Entry with Inline Images
Let's say there is a blog entry, which you have the HTML for, it l开发者_如何学Goooks like this:
<h1>Hi</h1>
<img src="http://thesource.com/someImage.gif"/>
<p>And just a little more text, with a </p>
If you use the graph API to send this to Facebook, the message will look exactly as it appears above. I'm using HTMLCleaner in order to clean the HTML, which will remove all the HTML, so it looks more like:
Hi
And just a little more text, with a
Is there any way to send this to Facebook, and have them render it properly? Will I need to manually strip images out and place them back into the text that I send over? How can I get rid of special HTML characters like
To convert the entities, use html_entitiy_decode()
And if you want to include images (or other media) in your stream post, you'll have to do that as an attachment.
精彩评论