22 NovHow to get older Battle Feed Events

As the post says, this is a way to get older Battle Feed Events – basically when someone would click, View More Events, these are the events that would be returned, NOT the most recent.

Using Blake Harley’s BF3 API, I figured out how to pull some of the older events from the feed.  Blake’s API (even after the Nov 22nd Battlelog updates) is required because you have to be logged into Battlelog in order to view Battle Feed events using this method.

I created a new public method that would go into the BattlelogAPI class:

class BattlelogApi {

public function getFeedData($url) {
$this->_checkCredentials();

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, BLA_COOKIE_FILE);
$feedData = json_decode(curl_exec($ch), true);
curl_close($ch);

// Return Data
return $feedData;
}
}

This method will return the JSON data from any URL and return it into a PHP array. Using the following URL we can get a players feed:

http://battlelog.battlefield.com/bf3/feed/homeevents/

This will return the Battle Feed events from THE logged in user’s home page.

Keep in mind, this will not give the most recent events from the feed, rather the events that would appear after you click View More Events. Strange I know, but I am posting this hoping it will steer someone in the right direction and allow us to get the most recent Battle Feed events.

 

Please leave a comment and share if you have any details that could help.

Post Tagged with , , , ,

Comments are closed.