53°F

Aaron Parecki

  • Articles
  • Notes
  • Photos
  • New Micropub library + XRay

    February 3, 2018
    1. curl https://example.com/micropub -X POST -d h=entry -d content="Hello World" \
    2. -d photo=http://example.com/foo.jpg -d category=foo -d published=2018-01-01T10:00:00-0800
    3.  
    4. ---
    5.  
    6. <?php
    7. require('vendor/autoload.php');
    8.  
    9. $xray = new p3k\XRay();
    10.  
    11. // Read the input as a string to handle both form-encoded and JSON requests
    12. $input = file_get_contents('php://input');
    13.  
    14. // Parse the Micropub request
    15. $request = p3k\Micropub\Request::create($input);
    16.  
    17. // Output as an Mf2 array
    18. $item = $request->toMf2();
    19.  
    20. // Turn it into an Mf2 page
    21. $mf2 = ['items' => [$item]];
    22.  
    23. // Process via XRay
    24. $parsed = $xray->process(false, $mf2);
    25.  
    26. print_r($parsed['data']);
    27.  
    28. ---
    29.  
    30. Array
    31. (
    32. [type] => entry
    33. [published] => 2018-01-01T10:00:00-0800
    34. [category] => Array
    35. (
    36. [0] => foo
    37. )
    38.  
    39. [photo] => Array
    40. (
    41. [0] => http://example.com/foo.jpg
    42. )
    43.  
    44. [content] => Array
    45. (
    46. [text] => Hello World
    47. )
    48.  
    49. )
    Portland, Oregon • 56°F
    Sat, Feb 3, 2018 4:07pm -08:00 #micropub
Posted in /code using quill.p3k.io

Hi, I'm Aaron Parecki, Director of Identity Standards at Okta, and co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and participate in the OAuth Working Group at the IETF. I also help people learn about video production and livestreaming. (detailed bio)

I've been tracking my location since 2008 and I wrote 100 songs in 100 days. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel. Read more.

  • Director of Identity Standards at Okta
  • IndieWebCamp Founder
  • OAuth WG Editor
  • OpenID Board Member

  • 🎥 YouTube Tutorials and Reviews
  • 🏠 We're building a triplex!
  • ⭐️ Life Stack
  • ⚙️ Home Automation
  • All
  • Articles
  • Bookmarks
  • Notes
  • Photos
  • Replies
  • Reviews
  • Trips
  • Videos
  • Contact
© 1999-2025 by Aaron Parecki. Powered by p3k. This site supports Webmention.
Except where otherwise noted, text content on this site is licensed under a Creative Commons Attribution 3.0 License.
IndieWebCamp Microformats Webmention W3C HTML5 Creative Commons
WeChat ID
aaronpk_tv