Skip to content

Instantly share code, notes, and snippets.

@Katzenwerfer
Created April 19, 2023 06:02
Show Gist options
  • Save Katzenwerfer/38546ee7ceec2609b2f0f1a0f6d42cd9 to your computer and use it in GitHub Desktop.
Save Katzenwerfer/38546ee7ceec2609b2f0f1a0f6d42cd9 to your computer and use it in GitHub Desktop.
Send a request to Litterbox's API using curl.exe
function Litterbox-Request {
param (
[Parameter(
Mandatory,
Position = 0,
ValueFromPipeline = $true,
HelpMessage = "Path to a file or a media URL."
)]
[ValidateNotNullOrEmpty()]
[string]
[System.IO.FileInfo]$InputFile,
[parameter(
Position = 1,
HelpMessage = "Type of request to be sent towards the API."
)]
[ValidateSet(
"fileupload"
)]
[string]
$RequestType = "fileupload",
[parameter(
Position = 2,
HelpMessage = "The time you want the file to be hosted before deletion."
)]
[ValidateSet(
"1h",
"12h",
"24h",
"72h"
)]
[string]
$HostingTime
)
curl.exe -F "reqtype=$RequestType" -F "time=$HostingTime" -F "fileToUpload=@$InputFile" https://litterbox.catbox.moe/resources/internals/api.php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment