Home > Backend Development > PHP Tutorial > 请教 curl 命令在PHP中如何用

请教 curl 命令在PHP中如何用

WBOY
Release: 2016-06-13 10:35:09
Original
946 people have browsed it

请问 curl 命令在PHP中怎么用


如下
curl -X POST -v -c cookies.txt -d "{\"username\":\"uname\",\"password\":\"pas word\"}" -H "Content-Type: application/json" xxx.com/ah/session
这个命令 

在PHP中如何使用以上命令?

谁能提供完整的示例,小弟感激不禁~~~~~~~~~




------解决方案--------------------
// 1. 初始化
$ch = curl_init();
// 2. 设置选项,包括URL
curl_setopt($ch, CURLOPT_URL, "http://www.nettuts.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 3. 执行并获取HTML文档内容
$output = curl_exec($ch);
// 4. 释放curl句柄
curl_close($ch);
 


------解决方案--------------------
http://www.chinaz.com/program/2010/0119/104346_2.shtml
------解决方案--------------------

探讨

引用:

看资料也学不会? 那你懂这个curl命令行的含义吗。


就是不明白这个命令行的含义
所以才想知道PHP如何翻译这个命令行的
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template