如何以编程方式使用PHP提交表单(我假设使用curl?)并获取生成页面的文件标记?PHP:以编程方式提交表单并获取结果页面的内容?
3
A
回答
7
在这里看到相关细节在此:
http://www.html-form-guide.com/php-form/php-form-submit.html
如:
<?php
$url = 'http://localhost/curl/1.php';
$params = "keyword=123&zxczxc=333"; //you must know what you want to post
$user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo "Results: <br>".$result;
?>
1.PHP内容:
<?
print_r($_POST);
?>
上SO相关问题:
https://stackoverflow.com/search?q=php+form+curl
Posting a textarea form with cURL
Using PHP & curl to post an html form that includes a file
的其他文章:
http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
http://davidwalsh.name/execute-http-post-php-curl
http://curl.haxx.se/mail/curlphp-2004-04/0013.html
http://phpsense.com/php/submitting-forms-using-php-curl.html
http://www.maheshchari.com/submit-a-form-to-remote-server-with-php-curl/
相关问题
- 1. 以编程方式提交表单
- 2. 以编程方式提交表单
- 3. Web Scraping - 以编程方式提交和提取表单的值
- 4. PHP提交表单并获取部分结果是进步
- 5. 获取表单提交的结果
- 6. 如何以编程方式填写AJAX表单并获取结果?
- 7. 以编程方式获取网页内容
- 8. 如何以编程方式提交已填写的表单并取消生成的页面?
- 9. 不加载页面内容并提交表单?
- 10. 多个表单提交并从结果页面解析数据
- 11. 提交php表单后自动跳回到页面内容
- 12. 如何以编程方式获取Linux内核页面大小
- 13. 以编程方式提交表单并通过分页循环(C#.NET)
- 14. PHP - 提交表单后我的表单页面冻结
- 15. 从表单提交的PHP页面获取数据
- 16. PHP提交表单到另一个页面,并运行方法
- 17. Kentico:以编程方式检索页面的呈现内容
- 18. 以编程方式更新dokuwiki页面内容的选项
- 19. jQuery - 获取页面的HTML内容并删除表单元素
- 20. 如何使用PHP DOM获取页面样式表的内容?
- 21. 如何在使用WWW :: Mechanize提交表单后获取页面内容?
- 22. 以编程方式提取InstallShield setup.exe文件的内容
- 23. 以编程方式设置发布页面内容
- 24. ASP.NET从内容页面以编程方式更改Site.Master锚点
- 25. 通过web表单提交数据并提取结果
- 26. 获取HTML内容提交
- 27. 以编程方式提取PDF表格
- 28. 提交表单并重定向页面
- 29. 提交的角度表单提交不显示PHP的结果
- 30. 如何更改表单提交后的页面内容ASP.net C#
谢谢你的冷嘲热讽。 – StackOverflowNewbie 2010-12-03 12:16:19