Songkick Concerts and Festivals
[resolved] Calling user IP (4 posts)

  1. randymir
    Posted 2 years ago #

    In a past post someone was trying to have Songkick use the users IP address. You had said to load the below code into their "songkick_metro_area_events.php" file.

    $ip = $_SERVER['REMOTE_ADDR'];
    return "$this->apiurl/events.json?location=ip:$ip&apikey=$this->apikey&per_page=$per_page&page=$page";

    I did that and this is now what my file looks like. Not sure if I placed it in the correct place.

    require_once dirname(__FILE__) . '/songkick_events.php';
    class SongkickMetroAreaEvents extends SongkickEvents {
        public $id;
        public $apikey;
        function SongkickMetroAreaEvents($apikey, $id) {
            $this->id = trim($id);
        function profile_url() {
            return "http://www.songkick.com/metro_areas/$this->id";
        protected function url($page, $per_page) {
            $ip = $_SERVER['REMOTE_ADDR'];
    return "$this->apiurl/events.json?location=ip:$ip&apikey=$this->apikey&per_page=$per_page&page=$page";

    Assuming I have the code right (If I don't please let me know what I did wrong.) How would I call the apikey up in the widget, or as a shortcode?


  2. dannyb123abc
    Posted 2 years ago #


    I too am having difficulty being able to implement this hack. I return no results using the above method.

    Let me know how we both can find solutions to this interesting need.



  3. saleandro
    Plugin Author

    Posted 2 years ago #

    randymir: Your code looks right. You can use it as you would to get metro area events. So the shortcode would be:
    [songkick_concerts_and_festivals songkick_id=your_metro_area_id songkick_id_type=metro_area]
    Let me know if it worked!

    dannyb123abc: can you tell me what ip address you're testing with? what does $_SERVER['REMOTE_ADDR'] return?

    ps: sorry for the late reply!

  4. saleandro
    Plugin Author

    Posted 2 years ago #

    I'm guessing it worked :)
    Marking it as closed for now, let me know if you guys have more questions!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Songkick Concerts and Festivals
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic