randomsymbols/fsubmit
Composer 安装命令:
composer require randomsymbols/fsubmit
包简介
Submit HTML forms from PHP
README 文档
README
Have you ever tried to submit an HTML form with cUrl? You have to clearly state all the fields you submit and what values they have.
In real life, we most often only want to fill in one or two fields without even thinking about what other fields are.
If you hardcode the other fields' values into your cUrl request, what if the form changes over time? You code will be broken.
To keep you code adoptable to the changes of the form, you will have to download the form as is first, parse its fields and values, change/add values to the right fields and submit it with cUrl.
It causes a lot of questions if you do not know how HTML forms work. For example, if there is a select tag with several options, which one will be submitted as the value for the field if none is selected? What if the option tag has no value attribute?
An Internet browser does the job for us when we submit a form. We do not have to bother about hidden fields or any other fields at all. The library provides the same functionality for PHP.
Requirements
PHP 7.4 and later.
Composer
You can install the library via Composer. Run the following command:
composer require randomsymbols/fsubmit
To use the library, use composer's autoload:
require_once('vendor/autoload.php');
Dependencies
The library requires the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, make sure these extensions are available.
Getting Started
use Fsubmit\Form; $form = Form::fromUrl('https://www.google.com'); $form->setParams(['q' => 'John 3:16']); $answer = $form->submit(); echo $answer['content'];
randomsymbols/fsubmit 适用场景与选型建议
randomsymbols/fsubmit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 83 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 randomsymbols/fsubmit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 randomsymbols/fsubmit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 83
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2020-10-16