phpinfo() 显示 cURL 已启用,但我仍然无法使用它
我正在制作页面获取脚本&我用的是curl。我使用了该函数:
get_data($url);
但我总是收到错误:
致命错误:在第 16 行 D:\wamp\www\grab\grab.php 中调用未定义的函数 get_data()
我正在使用 WAMP 服务器我已经在所有ini文件中启用了curl扩展,我已经检查了扩展目录路径,但一切看起来都很好,但我仍然卡住了。
I am in the process of making a page fetch script & I was using curl for it. I used the function:
get_data($url);
but I always get the error:
Fatal error: Call to undefined function get_data() in D:\wamp\www\grab\grab.php on line 16
I am using WAMP server and I have enabled curl extentions in all the ini files, I have checked the extensions directory path but everything seems fine and I am still stuck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有
get_data
功能!!您必须自己编写一个代码:
There is not
get_data
function!!You'll have to code one yourself as:
使用此功能。没有
get_data
函数:Use this function. There is no
get_data
function:我不是使用 cUrl 的专家...但我从未听说过 get_data() 函数是 cUrl 的一部分。
http://es.php.net/manual/en/book.curl。 php
要进行查询,您必须创建一个curl实例:
然后您可以使用以下命令执行查询:
...基本上。
使用 curl_setopt (http://es. php.net/manual/en/function.curl-setopt.php)您可以设置各种选项(我确信您需要这样做)。
一个特别有用的选项是,使curl更容易使用:
这使得curl_exec()返回一个包含响应内容的字符串。
所以整个例子的结尾是这样的:
I'm not an expert using cUrl... but I've never heard about that get_data() function being part of cUrl.
http://es.php.net/manual/en/book.curl.php
To make a query you must create a curl instance:
And then you can execute the query with:
...basically.
With curl_setopt (http://es.php.net/manual/en/function.curl-setopt.php) you can set various options (I'm sure you will need to).
One option specially useful that makes curl even easer to use is:
This makes curl_exec() to return a string with the content of the response.
So the whole example ends like: