使用PHP Curl提交表单不起作用

时间:2019-06-02 02:00:17

标签: php php-curl

我尝试过,但是没有上传文件,也没有提交表单

$email = 'name@example.com';
$full_name = 'Full Name';
$cFile = '@' . realpath('image.jpeg');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://m.facebook.com/help/contact/260749603972907');
curl_setopt($ch, CURLOPT_POSTFIELDS,'Field707360896076073='.urlencode($email).'&full_name='.urlencode($full_name).'&Field693845437294697[]='.$cFile.'');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, "https://www.google.com");
$page = curl_exec($ch) or die(curl_error($ch));
echo $page;

0 个答案:

没有答案