Skip to content

Latest commit

 

History

History
75 lines (62 loc) · 2.47 KB

File metadata and controls

75 lines (62 loc) · 2.47 KB

AffiliTest-PHP

AffiliTest's API implemented in PHP

Installation

  • Clone this repo (git clone https://github.com/tsirolnik/AffiliTest-PHP.git)
  • cd into the directory (cd AffiliTest-PHP)
  • Install composer as instructed here
  • Install the dependencies using composer(php composer.phar install in the current directory)
  • You're ready to go

Copy&Paste Installation

git clone https://github.com/tsirolnik/AffiliTest-PHP.git
cd AffiliTest-PHP
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar install

Docker Image

In order to run the Dockerfile run the following commands in the folder -

sudo docker build . -t affilitest/php
sudo docker run -p 8080:80 --name affilitest -dt affilitest/php

You will be able to run the files via accessing your localhost on port 8080 as in - http://localhost:8080/example.testing.php You can obivously change the Dockerfile as you would like.

Examples of usage

Testing

App Info

Example code

Calls Left

Example code

Retrieving HTTP Status codes

In order to view the redirections' status codes, a query string is needed to be appended to the endpoints.

Open the API.php file and append ?codes to the desired endpoint.

Currently, only /test and /compareToPreview are the ones which support this feature.

...
POST https://affilitest.com/api/v1/test?codes
...
HTTP 200 OK
...
{
  error: null,
  meta: {
    codes : [200, 301, 302]
  },
  data: ["example.com", "redirection.com", "destination.com"]
}

Supported devices

Devices are located in affilitest/API.php in the class Devices.

  • Android
  • iPhone
  • iPad
  • Desktop
  • Windows Phone
  • Blackberry

All of these devices are supported, using uppercase in the examples provided.