Embed.ly 和 PHP...第 2 轮
显然我的最后一个问题太模糊了,尽管它非常简单。
我正在尝试使用 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'
)
));
?>
我收到以下错误:
( ! ) Fatal error: Call to undefined function Embedly\curl_init() in C:\wamp\www\Embedly .php 第 259 行
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来curl 尚未安装或启用。
如果您使用自己的服务器(假设类似于 ubuntu 服务器),一个简单的
sudo apt-get install php5-curl
应该可以解决它。否则,您可能需要联系您的托管提供商。
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: