Skip to content

Instantly share code, notes, and snippets.

<?php
class MediumPoster
{
private CurlService $service;
private string $workingdir;
public function __construct($intToken, $workingdir = "")
{
$this->intToken = $intToken;
<?php
class CurlService
{
private string $baseUrl;
private array $headers = [];
public function __construct(string $baseUrl)
{
$this->baseUrl = $baseUrl;
$this->setHeader("Content-Type", "application/json");
#!/usr/local/bin/php
<?php
function usage(?string $msg = null): string
{
$argv = $GLOBALS['argv'];
$usage = "\n";
$usage .= sprintf("usage: %s <what>\n", $argv[0]);
$usage .= sprintf("%6s %-6s %s\n", "-h", "", "this help message");
$usage .= sprintf("%6s %-6s %s\n", "-a", "<more>", "add a little more");