Я пытаюсь заполнить и отправить внешнюю форму с помощью cURL, но на самом деле я не могу заполнить поле, и я бы понял, почему.Заполнить внешнюю форму cURL
Как я могу увидеть заполненную форму сразу после подачи формы?
Я следующий код:
<?php
//create array of data to be posted
$post_data['fname'] = 'Mario';
$post_data['lname'] = 'Rossi';
$post_data['email'] = '[email protected]';
$post_data['memberid'] = '1010101010';
$post_data['mobile'] = '3456789';
//traverse array and prepare data for posting (key1=value1)
foreach ($post_data as $key => $value) {
$post_items[] = $key . '=' . $value;
}
//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);
//create cURL connection
$curl_connection =
curl_init('http://dennehys.ie/mobile/douglas/formview.php?qstr=dHlwbz0mZGF5PVR1ZXNkYXkmZGF5ZGF0ZT0yMDE2LTAxLTI2JnJuZD0mY2xhc3NzaGVkdWxlPTQ5Mw==');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection);
print_r($post_data);
echo $result;
//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' .
curl_error($curl_connection);
//close the connection
curl_close($curl_connection);
?>
Я попытался изменить строку, о которой вы мне говорили, но на странице покажу мне следующий ответ: Пожалуйста, предоставьте действующее письмо. Я попытался вставить URL-адрес: «http://dennehys.ie/mobile/douglas/formresponse.php» в браузере, но ответ тот же. – macco