Embed.ly and PHP... round 2
Apparently my last question was too vague even though it was pretty straightforward.
I'm trying to use Embed.ly's API to embed some stuff, for example, some of the stuff shown here. https://github.com/embedly/embedly-php/blob/master/README.rst
I have the entire Embedly.php source file in my working directory.
However, when I have the following in开发者_开发知识库 my header file:
<?php
//require_once('Embedly/src/Embedly/Embedly.php'); // if using pear
require_once('./Embedly.php'); // if using source
$api = new Embedly\Embedly(array('user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)'));
?>
And the following in my main page:
<?php
$objs = $api->oembed(array(
'urls' => array(
'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos',
'http://twitpic.com/3yr7hk'
)
));
?>
I get the following error:
( ! ) Fatal error: Call to undefined function Embedly\curl_init() in C:\wamp\www\Embedly.php on line 259
It looks like curl isn't installed or enabled.
If you're on you own server (assuming something similar to ubuntu server), a simple sudo apt-get install php5-curl
should solve it.
Otherwise, you may have to contact your hosting provider.
Got this from a forum and it seems legit:
- Close WAMP (if running)
- Navigate to WAMP\bin\php(your version of php)\
- Edit php.ini
- Search for curl, uncomment extension=php_curl.dll
- Navigate to WAMP\bin\Apache(your version of apache)\bin\
- Edit php.ini
- Search for curl, uncomment the line/remove the #, extension=php_curl.dll
- Save the files
- Restart WAMP
精彩评论