简体   繁体   中英

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 looks like this:

<h1>Hi</h1>
<img src="http://thesource.com/someImage.gif"/>
<p>And just a little more text, with a &nbsp;</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 &nbsp;

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 &nbsp;

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM