Domain API

Did you know that we have an API that automatically retrieves up-to-date domains?

1) To connect, go to the “settings” tab and select “Domain APIs”. Click the “Generate Key” button.
2) The generated key must be inserted into the server script (it can be PHP or ASP scripts). If you don’t have a script, you can use our example.
3) Next, the script will periodically access the API once in each period.
You can download the working script here. When activated, it creates and updates the popunder_code.txt file. The javascript code from the Popunder section is written to the file with the relevant domain.

How to run the script?

To get an up-to-date domain, you need to set up the regular implementation of the domain.php script through the cron utility on the server, or generate the script directly. Once the file is created, it will not be updated for the time specified in the $apiCacheTime parameter. To force a file update, you need to pass the parameter fc=1

For example:

domain.php?fc=1 – if the script is generated directly
domain.php fc=1 – if the script is generated by cron
If you have several domains available for the vertical specified in the settings, the script will write the first domain to the file.

Settings:

For the script to work correctly, you need to specify the following settings.
• $apiAffToken – domain API access key from https://www.lospollos.com/stats/api_domain. For example: 53e583971f9c4f3f9b43e0709baae4a6
• $apiAffData – link parameters for the desired vertical. For example: ?u=XXXXXXXX&o=YYYYYYY
• $apiVertical is the name of the vertical for which you want to get the actual domain. For example: Dating
• $apiCacheTime – your preferred interval to update the popunder_code.txt file measured in minutes. It is best not to access the domain API too often, once every 15 minutes is enough.
• Before running the script, you need to make sure that the domain.php script has permissions to create and edit the popunder_code.txt file

Finally, having set up the receiving mechanism once, you will no longer have to receive information about domain changes from support and change it manually in your links! How convenient!

You might also like