Skip to content

Dynamic generate image with BF1 server information in real-time, using battlefieldtracker API.

Notifications You must be signed in to change notification settings

CubanJew/BF1-Live-Server-Banner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BF1-Live-Server-Banner

Dynamically generate image with BF1 PC server information in real-time in PHP using battlefieldtracker API JSON data.

Usage

To use default hardcoded serverID, execute /sig.php.

To supply server ID dynamically pass server ID as s_id argument (e.g., sig.php?s_id=5428144750219).

Installation Instructions

  1. Upload sig.php and /media directory to web server.

  2. Obtain an API key from https://battlefieldtracker.com/site-api

  3. Open up sig.php and replace YOUR_API_KEY with your battletracker API key inside of getData() function (in curl_setopt($ch, CURLOPT_HTTPHEADER....)

  4. (OPTIONAL) BF1 Server ID will randomly change. In order to optimize execution time of sig.php, a default serverID ($nwgServerID) is hardcoded in the script if server ID argument is not provided. A separate script (sig_scrape_server_id.php) may be run via CRON job (command php -q /home/.../public_html/...sig_scrape_server_id.php) in CPANEL to periodically check and update default hardcoded serverID in sig.php.

  • Upload sig_scrape_server_id.php and includes/simple_html_dom.php
  • Edit the following search URL inside scrapeServerID() of sig_scrape_server_id.php: $html = file_get_html('https://battlefieldtracker.com/bf1/servers?platform=pc&name=nwg'); Make sure the search URL only retrieves a single result.

When additional maps are released, you'll need to add new background canvas images containing a thumbnail picture of the map into the /media/img_canvas/ directory. The GIMP image template titled "banner template.xcf" is included in this directory.

Warning: If testing this on a local Windows-based Apache server (e.g., XAMPP), you'll need to add the SSL sertificate per directions here: http://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate

About

Dynamic generate image with BF1 server information in real-time, using battlefieldtracker API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages