duaevb1511 2018-09-21 15:40
浏览 16

如何在框架phpixie上伪造请求

I have the following code:

$framework = new \Project\Framework();
//$framework->registerDebugHandlers(false, false);

$slice = new \PHPixie\Slice();
$http  = new \PHPixie\HTTP($slice);

$serverRequest = new PHPixie\HTTP\Messages\Message\Request\ServerRequest\SAPI(
    $http->messages(),
    [
        'REQUEST_METHOD'  => 'GET',
        'REQUEST_URI'     => 'http://localhost/v/param',
        'SERVER_NAME'     => 'localhost',
        'SERVER_PROTOCOL' => 'HTTP/1.1',
        'HTTP_HOST'       => 'localhost',
        'Content-Type'    => 'application/text',
    ],
    ['get'    => 1],
    ['post'   => 1],
    ['cookie' => 1],
    ['files'  => 1],
    [
        'enc_params' => 'param',
    ]
);

var_dump($framework->processHttpServerRequest($serverRequest)->getBody());

If you run this code through the console i get:

PHP Notice: Undefined index: REQUEST_METHOD in /vendor/phpixie/http/src/PHPixie/HTTP/Messages/Message/Request/ServerRequest/SAPI.php on line 45

Although the page will be received

I tried to insert the following code at the top of the page, but it did not help

$_REQUEST = [
    'REQUEST_METHOD' => 'GET',
    'REQUEST_URI'    => 'http://locahost/v/param',
];

and if you call this code through the browser, then everything is fine

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用