开发者

Embed.ly and PHP... round 2

开发者 https://www.devze.com 2023-03-11 18:38 出处:网络
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.

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:

  1. Close WAMP (if running)
  2. Navigate to WAMP\bin\php(your version of php)\
  3. Edit php.ini
  4. Search for curl, uncomment extension=php_curl.dll
  5. Navigate to WAMP\bin\Apache(your version of apache)\bin\
  6. Edit php.ini
  7. Search for curl, uncomment the line/remove the #, extension=php_curl.dll
  8. Save the files
  9. Restart WAMP
0

精彩评论

暂无评论...
验证码 换一张
取 消