Php 可以使用curl_setopt获取输入值
这是我的文件.phpPhp 可以使用curl_setopt获取输入值,php,curl,Php,Curl,这是我的文件.php $ch = curl_init("http://mywebsite.com/test.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
$ch = curl_init("http://mywebsite.com/test.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$c = curl_exec($ch);
curl_close($ch);
return $c;
我有一个带有输入类型文本和按钮的表单,我想问,如果我能用这个脚本将输入发送到我的网站,会怎么样 如果您网站上的表单有文本输入,并且您希望使用cURL将表单提交到您的网站,那么您需要查找
CURLOPT\u POSTFIELDS
除了您所拥有的,还应添加:
$fields = array(
'name' => 'Name', // array key corresponds to the name of a field on your form
'email' => 'you@yoursite.com',
);
$data = http_build_query($fields);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$c = curl_exec($ch); // post form to your site
你要什么?返回$C将得到test.php、html和所有文件的响应。或者你得到了什么。