curl入门知识之抓取二进制数据
2010-08-12 21:29
316 查看
<?php // Allocate a new cURL handle $ch = curl_init("http://www.designmultimedia.com/intro.jpg"); if (! $ch) { die( "Cannot allocate a new PHP-CURL handle" ); } // We'll be returning this transfer, and the data is binary // so we don't want to NULL terminate curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); // Grab the jpg and save the contents in the $data variable $data = curl_exec($ch); // close the connection curl_close($ch); // Set the header to type image/jpeg, since that's what we're // displaying header("Content-type: image/jpeg"); // Output the image print( $data ); ?>
相关文章推荐
- curl入门知识之抓取数据并分析链接或Url
- curl入门知识之抓取数据并分析响应头并调用回调函数
- curl入门知识之一次抓取多个远程网站的数据
- curl入门知识之简单的抓取一个远程网页
- curl入门知识之POST数据
- 用curl抓取网站数据,仿造IP、防屏蔽终极强悍解决方式
- 小白入门angular-cli的第一次旅程(学习目标 1.路由的基础知识 在路由时传递数据)
- PHP的cURL库功能简介 抓取网页、POST数据及其他
- MySQL---数据库从入门走向大神系列(九)-用Java向数据库读写大文本/二进制文件数据
- php使用curl和正则表达式抓取网页数据示例
- PHP使用Curl实现模拟登录及抓取数据功能示例
- 数据恢复入门-基础知识
- Python学习手册(1入门知识-数据类型)
- python 入门实践之网页数据抓取
- PHP的CURL方法curl_setopt()函数案例介绍(抓取网页,POST数据)
- Java基础(极客)——01、Java编程基础知识入门:变量与数据类型
- curl_multi在抓取数据中的并发实现
- SQLite入门(二)读写二进制数据
- 抓取并处理WEB页面数据(CURL/DOM)
- 【引用】PHP的cURL库功能简介:抓取网页,POST数据及其他