Web iconSSL Lock icon / Tor Logo / I2P Logo — Browsing Safely ( read more )

How to create a PHP client to integrate with the snapWONDERS API



The purpose of this tutorial is to show you how you can create a PHP client example to the snapWONDERS API. This includes a step-by-step guide how to set up your development environment, the example source code and instructions on how to test and run.

What is PHP?

PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group.

Objectives

Through the example source, you will be able to:

  • Upload digital media (using resumable uploading following the Tus.io protocol)
  • Perform deep digital media analysis, reveal hidden metadata, hidden metadata, copyrights, steganography and private information leakage
  • Display the results from the analysis (in which you can extract and make use as needed)

Installation and setup

Development environment

For the development environment you will need:

  • Install Visual Studio Code. You can download and install from visual code studio
  • Composer if you don't have it installed. To install and to set up you can follow these instructions from Install Composer
  • Ensure that PHP is up and running in your development environment and in the path
  • Install all the vendor packages via `php.exe composer.phar install`
  • Update all your details in the Visual Code `settings.json` file to allow Visual Code to debug PHP and run it. You will need to set up your PHP paths etc. Currently, for PHP development I have a WAMP setup, but this may vary for your development environment and you can adjust as needed
  • Depending on your PHP setup for development, it may be possible you will get cURL certificate issues when running and you will need to set SSL up:
    1. You can set up the SSL for cURL and php.ini;
    2. Disable SSL verification (NOT FOR PRODUCTION USE) by updating the constant `DISABLE_SSL` to `true` in the `src/constants/Helper.php` file
  • Install the plugins needed for Python into Visual Studio Code as needed. See images below for plugins I had installed:




snapWONDERS API Key

You will need the snapWONDERS API Key before you can get started:

  • Signup and create an account at snapWONDERS at signup. If you wish to create account via Tor or I2P then you can do so by accessing snapWONDERS via the Tor or I2P portals. For the dark web links visit browsing safely
  • Under your account settings, scroll to the bottom under the section "API Settings" and click the button to generate your Auth API key
  • Copy this key directly into the `src/constants/Helper.php` file under the constant SNAPWONDERS_API_KEY

Source Code

The source code for these examples are located on GitHub - https://github.com/snapWONDERS/example-PHP-client-to-snapWonders-API

Running the PHP example

Once everything above is setup, and you've downloaded the source, you should be able to simply open the workspace folder with Visual Studio Code and run or debug it. Simply hit the default hot keys F5 to start debugging or to run directly use Ctrl+F5.

If you wish, you can change and provide your own digital media to upload (images and/or videos) and change the MEDIA_PATH_FILENAME constant contained in the constants_helper.py file. Otherwise the sample image provided is just a photo of me that I use on my social media accounts.

If all is well, then you should see the standard output to be something like below:

Example for standard output display for Go client to snapWONDERS API

Which provides similar information as per the analyse results via the snapWONDERS website:

Results sample as showing on the snapWONDERS website

Documentation

Useful documentation can be found at:

Contact

For security concerns

If you have spotted any security concerns then please reach out via contacting snapWONDERS and set the subject to "SECURITY CONCERNS" and provide the information about your concerns. If you wish to contact via Tor or I2P then you can do so by accessing snapWONDERS via the Tor or I2P portals. For the dark web links visit browsing safely

For FAQ and questions

It may be possible that your questions are already answered in the FAQ. Be sure to check out the FAQ content first. Otherwise you may reach out via contacting snapWONDERS. If you wish to contact via Tor or I2P then you can do so by accessing snapWONDERS via the Tor or I2P portals. For the dark web links visit browsing safely


Kenneth Springer standing at the cliff edge with an Ocean backdrop

About the Author

Hi there, I'm Kenneth Springer (Founder / Technical Lead / Senior Full Stack Developer / Lead Solution Architect / Engineer / Innovator). All too often I see digital content being shared on social media and online and ponder about privacy concerns, hidden metadata, tracking, copyrights, online safety, steganography and accessibility. I created this website to create awareness and help make a better world online!