惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

追剧生活网

前端代替iframe的方法 - 追剧生活网 写领券工具时,遇到的问题 - 追剧生活网 “无法启动程序,计算机丢失 MSVCP120.dll”终极解决办法 - 追剧生活网 利用jQuery实现绑定按钮变色写法 - 追剧生活网 今天什么也不做,好好哭一场。 - 追剧生活网 解决微信播放视频无法全屏 - 追剧生活网 2020年,愿你我安康 - 追剧生活网 html5的video标签播放m3u8视频 - 追剧生活网
实例:php利用cURL传递post数据 - 追剧生活网
mengkun · 2021-06-04 · via 追剧生活网

说实话,我也不太懂。我只知道它能请求别的网站的信息,并返回响应。支持get、post请求,还能设置referer、cookie等等,具体看菜鸟教程吧:https://www.runoob.com/php/php-ref-curl.html

什么实例

有个活动,每天不定时放名额,所有我就用curl写了个页面,去监控它,放名额时给我发邮件。

直接放后端代码吧,前端就是写个ajax去请求后端。

   // 创建一个新cURL资源
   $ch = curl_init();
    // 设置URL和相应的选项
    curl_setopt($ch, CURLOPT_URL, "这里填请求的页面api");
    curl_setopt($ch, CURLOPT_HEADER, false);
    //声明使用POST方式来进行发送
    curl_setopt($ch, CURLOPT_POST, 1);
    $data12='这里填post的内容';
    //发送什么数据呢
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data12);
   //如果是get请求,就不用上面三行代码,其他都一样
    
    curl_setopt( $ch ,CURLOPT_REFERER, "这里填来源页面" );

   //设置cookie,如果不用cookie,就删掉
    $cookie = 'cookie内容';
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    // 抓取URL并把它传递给前端
    curl_exec($ch);
    //关闭cURL资源,并且释放系统资源
    curl_close($ch);

本文作者为隔壁小蒋,转载请注明。