如何在不实际访问URL的情况下在给定URL上执行PHP脚本?它可以在后面运行吗? [英] How do I execute a PHP script on given url without actually visiting the url? Is it possible to run it in the back?
问题描述
我想写一个获取字符串的php函数,转到我想要的url,将字符串放入该url中的文本字段,提交它并返回提交后显示的文本。我迷路了,帮帮我。
我尝试过的事情:
$ html = curl_init('www.thewebsiteiwanttorunmyscripton.com');
html = curl_init('www.thewebsiteiwanttorunmyscripton.com');
听起来您自动尝试在网站上填写表单,提交表单然后显示结果。我会检查网站的来源以查找相关字段,看看它在提交时的作用。
它看起来像这样:
< 表格 方法 = get action = / action.php >
< 输入 type = text name = field1 >
< / form >
表单的方法(获取)标识您是否应该发出POST或GET请求。
表单的操作(/ action.php)将为您提供请求的URL。
输入的name(field1)将是参数的名称。
I want to write a php function which gets a string, goes to the url I want, puts the string in to a text field in that url, submits it and returns the text shown after submitting. I'm lost guys, help me.
What I have tried:
$html= curl_init('www.thewebsiteiwanttorunmyscripton.com');
html= curl_init('www.thewebsiteiwanttorunmyscripton.com');
It sounds like you're automatically trying to fill a form on a website, submitting it and then showing the result. I would check the website's source to find the relevant field and see what it does on submitting.
It will look something like this:
<form method="get" action="/action.php"> <input type="text" name="field1"> </form>
The form's method ("get") identifies if you should do a POST or GET request.
The form's action ("/action.php") will give you the URL to request.
The input's name ("field1") will be the name of the parameter.
这篇关于如何在不实际访问URL的情况下在给定URL上执行PHP脚本?它可以在后面运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!