200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > php模拟post提交 curl post请求 postman 模拟请求 测试工具模拟请求...

php模拟post提交 curl post请求 postman 模拟请求 测试工具模拟请求...

时间:2022-04-29 12:54:31

相关推荐

php模拟post提交  curl post请求   postman 模拟请求   测试工具模拟请求...

curl post请求 , postman 模拟请求 , 在线测试工具模拟请求

发布时间:-08-09 11:05,

浏览次数:1206

, 标签:

curl

post

postman

1、curl发送post 请求

function curl_post($url = '', $param = '') { if (empty($url) ||

empty($param)) { return false; } $postUrl = $url; $curlPost = $param; $ch =

curl_init(); curl_setopt($ch, CURLOPT_URL,$postUrl); curl_setopt($ch,

CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,

$curlPost); $data = curl_exec($ch); curl_close($ch); return $data; } function

testAction(){ $url = ''; $post_data['appKey'] = ''; $post_data['regionId'] =

''; $post_data['token'] = ''; $post_data['sign'] = ''; $o = ""; foreach (

$post_data as $k => $v ) { $o.= "$k=" . urlencode( $v ). "&" ; } $post_data =

substr($o,0,-1); $res = $this->curl_post($url, $post_data); print_r($res); }

2、postman模拟post请求

3、还可以直接在网上搜索在线测试工具,模拟post请求,填入对应的参数即可

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。