Skip to content

Instantly share code, notes, and snippets.

@mujahidk
mujahidk / curl.ps1
Last active May 19, 2023 20:48
PowerShell WebClient script with basic authentication to export content from a website. Simple alternative to curl in Windows.
# Uncomment to disable Certificate errors
# [Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$url = "http://example.com/data.json"
$user = "data-user"
$password = "password"
# Output file path into current directory.
$file= ($pwd).path + "\export.json"
Write-Host "Exporting data to: $file"