简体   繁体   English

从页面运行带有变量的PHP脚本

[英]Run php script from page with variables invisibly

So, I am trying to run a .php script with javascript and some html without the user being able to see any code and passing variables. 因此,我正在尝试使用javascript和一些html运行.php脚本,而用户无法看到任何代码并传递变量。 I tried both CURL and command line: 我尝试了CURL和命令行:

//curl_setopt($req, CURLOPT_URL,"http://projectvintous.com/Ginav363534.php?activate=10297&to=$Itemname&Shirt=$filename&totype=shop");
//curl_exec($req);

$command = "../../Ginav363534.php 10297 $Itemname $filename shirt shop";
exec( "$ php -f $command");

But I couldn't get either to work. 但是我都不能上班。 Not getting any error or anything, it is just not running the script because none of the mysqli or file management things are happening. 没有收到任何错误或任何东西,它只是没有运行脚本,因为没有发生mysqli或文件管理的事情。 I am trying to get it to render a webgl model, save as an image using the image the user uploaded as a texture, then upload it to the server and save it in a folder and mysqli table. 我试图让它呈现一个webgl模型,使用用户作为纹理上传的图像另存为图像,然后将其上传到服务器并保存在文件夹和mysqli表中。

This is how I am getting the variables on the other side: 这就是我在另一端获取变量的方式:

$varz = var_dump($argv);

$activate = $varz[1];
$itemname = $varz[2];
$filename = $varz[3];
$filetype = $varz[4];
$type = $varz[5];

I also tried 我也试过

parse_str(implode('&', array_slice($argv, 1)), $_GET);

before with no luck as well. 之前也没有运气。 Is there another way to do this, am I missing something? 还有另一种方法,我是否缺少某些东西? It works when I run the url directly on the page, so I know that it works. 当我直接在页面上运行url时,它可以工作,所以我知道它可以工作。

You're trying to curl a page and have the Javascript on the page executed? 您要卷曲页面并执行页面上的Javascript吗? I don't think curl bothers to execute any JS on the pages, it just gets the raw file contents. 我不认为卷曲会在页面上执行任何JS,它只是获取原始文件的内容。 I think you'll need to do something like use Node.js and PhantomJS to open the page in a headless browser, which will execute the JS on the page. 我认为您需要执行诸如使用Node.js和PhantomJS之类的操作来在无头浏览器中打开页面,该浏览器将在页面上执行JS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM