是否可以自动提交php表单 [英] Is it possible to automatically submit a php form

查看:20
本文介绍了是否可以自动提交php表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,其中有几个 php 表单,我想用自动生成的内容填写这些表单(为了练习用户可以提交的不同内容).我想编写一个客户端应用程序,使我能够这样做.

I have a website in which I have a several php forms that I would like to fill out with auto generated content (for the purposes of exercising different content the user could submit). I would like to write a client side application that enables me to do so.

有没有办法使用 webtoolkit、java 脚本等来做到这一点?

Is there any way either using webtoolkit, java script etc of doing this?

推荐答案

如果您已经熟悉 php,为什么不在客户端"也使用 php?您可以使用 客户端 URL 包 将 POST 数据提交到网络形式.示例:

If you are already familiar with php, why not use php on the "client side" as well? You can use the Client URL package to submit POST data to a web form. Example:

<?php
$ch = curl_init();
$data = array('name' => 'phpnoob', 'address' => 'somewhere');

curl_setopt($ch, CURLOPT_URL, 'http://localhost/url/to/your/php/form.php'); // use the URL that shows up in your <form action="...url..."> tag
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_exec($ch);
?> 

这篇关于是否可以自动提交php表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆