Post访问使用file_get_contents不能解决411错误使用内容长度


post access using file_get_contents doesn't solve 411 error on using content length

我正在尝试使用file_get_contents访问post数据,但是我得到以下错误消息:

failed to open stream: HTTP request failed! HTTP/1.0 411 Length Required

虽然我使用Content-Length field的错误没有得到解决。这是我的代码,如果有人可以帮助我,提前感谢。

<?php
set_time_limit(0);
include "ui.php";
$oy= `perl E:/mul.pl`;
$context  = stream_context_create(array('http' => array('method'=>'POST', 'header'  => 'Content-type: application/x-www-form-urlencoded', 'Content-Length: 0', 'content' => '')));
$result = file_get_contents($oy, false, $context);
?>

您可以使用apache_note和虚拟PHP函数来运行perl

或查看本页的执行perl由PHP shell函数

在PHP中执行perl

如何从PHP调用Perl脚本?

使用shell_exec从php调用perl脚本

从PHP执行Perl脚本出现问题