您好,欢迎访问一九零五行业门户网

PHP curl

什么是curl
curl是利用url语法在命令行方式下工作的开源文件传输工具。
php 的用处
使用php的curl库可以简单和有效地去抓网页。你只需要运行一个脚本,然后分析一下你所抓取的网页,然后就可以以程序的方式得到你想要的数据了。无论是你想从从一个链接上取部分数据,或是取一个xml文件并把其导入数据库,那怕就是简单的获取网页内容,curl 是一个功能强大的php库。
demo1

demo2 post数据
﹤?php$phonenumber = '13812345678';$message = 'this message was generated by curl and php';$curlpost = 'pnumber=' . urlencode($phonenumber) . '&message=' . urlencode($message) . '&submit=send';$ch = curl_init();curl_setopt($ch, curlopt_url, 'http://www.lxvoip.com/sendsms.php');curl_setopt($ch, curlopt_header, 1);curl_setopt($ch, curlopt_returntransfer, 1);curl_setopt($ch, curlopt_post, 1);curl_setopt($ch, curlopt_postfields, $curlpost);$data = curl_exec();curl_close($ch);?﹥
demo3 使用代理服务器
﹤?php $ch = curl_init();curl_setopt($ch, curlopt_url, 'http://www.cmx8.cn');curl_setopt($ch, curlopt_header, 1);curl_setopt($ch, curlopt_returntransfer, 1);curl_setopt($ch, curlopt_httpproxytunnel, 1);curl_setopt($ch, curlopt_proxy, 'proxy.lxvoip.com:1080');curl_setopt($ch, curlopt_proxyuserpwd, 'user:password');$data = curl_exec();curl_close($ch);?﹥
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了php curl,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息