
URLにアクセスするコマンド達
目的(ブラウザを開く、APIを叩く、サーバーを立てる)に合わせたコマンドを選択してください。
1. シェルからブラウザを開いてURLにアクセスする OS標準のコマンドを使用して、指定したURLをデフォルトブラウザで開きます。
macOS: open [https://example.com](https://example.com)
Linux: xdg-open [https://example.com](https://example.com)
Windows (CMD/PowerShell): start [https://example.com](https://example.com)
2. APIやWebhookのURLを叩いてサービス(処理)をトリガーするcurlコマンドを使用して、シェルから直接HTTPリクエストを送信します。
GETリクエスト: curl [https://example.com/api/start](https://example.com/api/start)
POSTリクエスト: curl -X POST [https://example.com/api/start](https://example.com/api/start)
パラメータ付き(JSON): curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' [https://example.com/api/start](https://example.com/api/start)
3. ローカルディレクトリをWebサービスとしてURL(localhost)で起動する 手元のPCで簡易サーバーを立ち上げ、URL(http://localhost:8000 など)でアクセスできるようにします。
Python 3: python3 -m http.server 8000
Node.js: npx http-server
PHP: php -S localhost:8000
4. ローカルのサービスを外部URLとして公開する(トンネリング) 手元で動いているローカルサーバー(例: localhost:8000)に、外部からアクセス可能な一時的なURLを発行します。
Cloudflare Tunnel: cloudflared tunnel url http://localhost:8000
ngrok: ngrok http 8000