简体   繁体   中英

POST string to php script using PowerShell

I am looking for a method in PowerShell to post a basic string to a php script that looks like this:

<?php
$file =  date("Y-m-d_H-i-s") . ".creds";
file_put_contents($file, file_get_contents("php://input"));
?>

I hope you can help me, thank you!

I would like you to go through the link. It will help you to understand better .It has all the required examples.

PHP Powershell

You can use the Invoke-WebRequest cmdlet in PowerShell 3.0 and above to make a request to your web/PHP service.

The Invoke-WebRequest cmdlet has a bunch of parameters you can use to customise your request, like -Headers (for setting headers), -Body for setting the body content, and -ContentType for setting the content type of your request.

You'll most probably want to use the -Body parameter of the cmdlet to send your simple string.

Follow the link above for details and some examples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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