Question

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;

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top