AffiliTest's API implemented in PHP
- 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
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
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.
- Regular testing and compare to preview - Example code
- Multithreaded example (Checking multiple offers) - Example code
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"]
}
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.