PHPcurl 模拟 form表单提交

测试go结构, 同事模拟curl 一直过不去


测试可行的代码


<?php
$ch = curl_init();
$path = dirname(__FILE__)."/404.jpg";

$post_data = array(
                'path'=>'accessory20200310170042',
				'rename'=>'1',
				'path_type'=>'0',
                'files[]'=>new CURLFile($path)
            );
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);  
curl_setopt($ch,CURLOPT_BINARYTRANSFER,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
curl_setopt($ch, CURLOPT_URL, 'http://localhost:3001/upload/files?app_id=xxxx&timestamp=1111&token=22222');
$info= curl_exec($ch);
curl_close($ch);
   
print_r($info);

?>

原文链接: PHPcurl 模拟 form表单提交 版权所有,转载时请注明出处,违者必究。
注明出处格式:流沙团 ( https://www.gyarmy.com/post-573.html )

发表评论

0则评论给“PHPcurl 模拟 form表单提交”