php技术
当前位置:首页 > 商学院 > php技术 > 正文内容

php技术

php远程提交post函数

豫唐网络2023-03-01 08:3094

远程提交
方式:post
范围:所有php类型程序

函数代码

function post($params, $url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5000);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded;charset=utf-8'));
    $result = curl_exec($ch);
    var_dump(curl_error($ch));
    curl_close($ch);
    return $result;
}


扫描二维码推送至手机访问。

版权声明:本文由汤阴县豫唐网络科技有限公司发布,如需转载请注明出处。

本文链接:https://www.ytecn.com/post/553.html

分享给朋友:

相关文章

php将编码转换为UTF8

php将编码转换为UTF8

主要用于编码不统一导致出现乱码的情况,此函数会自动监测非UTF8编码转成UTF8编码。function ConverCode($str){ $encode = mb_d...

vscode运行php和Composer

vscode运行php和Composer

需要用到的工具1、安装php(官网下载)2、安装composer(官网)3、vscode插件PHP Server4、vscode插件PHP Debug5、windows 11系统步骤1、安装php安装...

phpRSA加密解密函数

phpRSA加密解密函数

使用方法:加密 $txt="ytecn";  $pubkey="公钥"  $macdata = RSAEn...

php删除连续空格

php删除连续空格

对字段中的连续空格进行删除只保留一个。应用案例$txt="     a b c   &nb...

php获取当前目录下文件夹列表

php获取当前目录下文件夹列表

获取当前目录下文件夹的名称应用案例$url="D:/wwwroot/ytecn.com/ui/"; $list=GetDirsInDir($url); print_r($lis...