21,882
社区成员
发帖
与我相关
我的任务
分享
$boundary = md5(time());
$postStr = "";
$postStr .="--".$boundary."\r\n";
$postStr .="Content-Disposition: form-data; name=\"uptxt[]\"; filename=\"index_1.html\"\r\n";
$postStr .="Content-Type: text/html\r\n\r\n";
$postStr .=$uploadFile."\r\n"; #这里是部分文件内容
$postStr .="--".$boundary."\r\n";
<?php
$url = 'http://www.myheritage.cn/FP/Company/tryFaceRecognition.php';//target url
$fields['file'] = '@'.'C:\Users\lzyy\Desktop\3431821560_5e18c02221.jpg';
$fields['lang'] = 'ZH';
$fields['morph'] = '1';
$fields['popup'] = 'PJSLVMMT';
$fields['loadMethod'] = 'myFiles';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields );
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_REFERER, "http://www.myheritage.cn/");
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);//get redirect content
curl_exec( $ch );
//$rs = curl_exec($ch);
if ($error = curl_error($ch) ) {
die($error);
}
curl_close($ch);
//print_r(htmlspecialchars($rs));
echo 'ok';
?>
$boundary = md5(time());
$postStr = "";
$postStr .="--".$boundary."\r\n";
$postStr .="Content-Disposition: form-data; name=\"uptxt[]\"; filename=\"index_1.html\"";
$postStr .="Content-Type: text~html";
$postStr .="123\r\n"; #这里是部分文件内容
$postStr .="--".$boundary."\r\n";
Array
(
[uptxt] => Array
(
[name] => Array
(
[0] => index_1.html"Content-Type: text~html123--91805707cf4d3a1cf19b6c42446b66a4
)
[type] => Array
(
[0] =>
)
[tmp_name] => Array
(
[0] =>
)
[error] => Array
(
[0] => 3
)
[size] => Array
(
[0] => 0
)
)
)