php php_crul
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php php_crul相关的知识,希望对你有一定的参考价值。
<?php
function do_Post($url, $fields, $extraheader = array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields );
curl_setopt($ch, CURLOPT_HTTPHEADER, $extraheader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function do_Get($url, $extraheader = array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $extraheader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回:
//curl_setopt($ch, CURLOPT_VERBOSE, true);
$output = curl_exec($ch) ;
curl_close($ch);
return $output;
}
function do_Put($url, $fields, $extraheader = array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url ) ;
curl_setopt($ch, CURLOPT_POST, true) ;
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields );
curl_setopt($ch, CURLOPT_HTTPHEADER, $extraheader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回
//curl_setopt($ch, CURLOPT_ENCODING, '');
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function do_Delete($url, $fields, $extraheader = array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url ) ;
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $extraheader);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回
//curl_setopt($ch, CURLOPT_ENCODING, '');
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
以上是关于php php_crul的主要内容,如果未能解决你的问题,请参考以下文章
linux 安装多个PHP版本(php5.6 php7.1 php7.2 php7.3 php7.4 php8.0)nginx配置php多版本
php [guzzle php] guzzle php #php
php send.php php邮件模板#php
IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?
如何从php5升级到php7
请问php中如何调用php文件中的内容?