Skip to content

Instantly share code, notes, and snippets.

@mdonkers
mdonkers / server.py
Last active April 30, 2024 23:26
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@nitaku
nitaku / README.md
Last active April 15, 2024 14:22
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@tautrimas
tautrimas / XmlToArrayParser
Last active February 24, 2022 21:17
Very good XML to PHP array converter found at http://outlandish.com/blog/xml-to-json/
<?php
/**
* Class XmlToArrayParser
*/
class XmlToArrayParser
{
/**
* @param SimpleXMLElement $xml
* @param array $options