How to develop a PHP Oembed provider?


I’m trying to develop an oembed provider in PHP.
The specs are more or less clear:

If I understand this correctly, I could simply try to do a static response - or am I wrong?

    header('Content-Type: application/json; charset=utf-8');
    "type":"link", "version":"1.0",  "provider_name ....

Unfortunately, it seems as if Pinterest doesn’t like this output - eventhough I checked it plenty of times and it lookes the same as their example does (just with my values).
Is there anything wrong with this approach for testing?

Does anyone know how to use php-oembed? Nice lib as it seems but I couldn’t find any docs and saw only an inactive Google group and a dead demo server. :frowning:

Any alterantives how to approach this task?

Thanks, Chris

I don’t have any experience with oEmbed, but I would take this ‘Pinterest example’ that you’re talking about and replicate it one to one. For example, add it to a PHP file as is. Just add the ‘Content-Type’ header and check if it works. If it doesn’t, there’s something else to it.

So, you can take the content of this URL (which they talk about in their doc):

Check that you effectively have the ‘Content-Type:application/json’ in your header with a ‘developer tools’ of a browser etc…

And check the source to be sure that there’s no garbage around… like some HTML or whatever.

Once this works, then add your own PHP code in there and see if it still works. :smile:

A static sample seems to be working now - maybe it was something about the URL parameters.
Still not sure, oembed seems to me as a sudden hype 2 years ago and then nobody every spoke about it anymore :-S

I never used it. I even forgot it ever existed before I saw your topic :wink:

I don’t have any experience using it either, but I did come across this while poking around Discourse files.

In Ruby not PHP but you may be able to get something from it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.