Embed.ly和PHP ...第2轮

时间:2011-06-08 18:22:19

标签: php html embed wamp

显然我的上一个问题太模糊了,即使它非常简单。

我正在尝试使用Embed.ly的API来嵌入一些东西,例如,这里显示的一些东西。 https://github.com/embedly/embedly-php/blob/master/README.rst

我的工作目录中有完整的Embedly.php源文件。

但是,当我在头文件中有以下内容时:

<?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)'));
?>

以下是我的主页:

<?php
    $objs = $api->oembed(array(
    'urls' => array(
    'http://www.youtube.com/watch?v=sPbJ4Z5D-n4&feature=topvideos',
    'http://twitpic.com/3yr7hk'
)
));
    ?>

我收到以下错误:

(!)致命错误:在第259行的C:\ wamp \ www \ Embedly.php中调用未定义的函数Embedly \ curl_init()

2 个答案:

答案 0 :(得分:0)

看起来没有安装或启用curl。

如果你在自己的服务器上(假设类似于ubuntu服务器),一个简单的sudo apt-get install php5-curl应该解决它。

否则,您可能需要联系您的托管服务提供商。

答案 1 :(得分:0)

forum得到这个,看起来很合法:

  1. 关闭WAMP(如果正在运行)
  2. 导航到WAMP \ bin \ php(您的php版本)\
  3. 编辑php.ini
  4. 搜索curl,取消注释extension = php_curl.dll
  5. 导航到WAMP \ bin \ Apache(您的apache版本)\ bin \
  6. 编辑php.ini
  7. 搜索curl,取消注释该行/删除#,extension = php_curl.dll
  8. 保存文件
  9. 重启WAMP
相关问题