0

i'm using iTunes API Search and Advanced Custom Field WordPress plugin so the wp author can add a mac app id to a custom field and the implanted iTunes Search API above will add all the other information of app automatically in the wp post. and when app information updated my wp post will have the updated info like last verion number app size and ...

but the problem is my own wrote review and guide of any verion of any app inside my website and it need to be updated manually.

for example i have added a post for version 3.7.1 of "Things 3" mac app using method above to my WordPress and i have reviewed this version with my own description and hand-wrote in the post.

now i need to get notified when ever this app gets a new version or update so i can update my review and add some text for new version inside the post as well.

is there any way or method you guys can think of, so i can get notified when ever an app i have reviewed in my site gets an update ?

i really appreciate any way or taught !

Thanks.

ErfanMHD
  • 1
  • 1
  • 2

2 Answers2

0

There is no native API to do what you're asking.

However, with a little coding I believe you could use the RSS feed of the application to then create something to notify you on a change.

See Example for the App HomeScan https://itunes.apple.com/lookup?id=1380025232

ID= YOURAPPID

I believe this should give you some general direction to do what you need.

  • hey mike, i appreciate your response, but the link u send is returning the comments or review of the app. can you be more specific on how can i use the reviews to get notified of apps for example this app? https://itunes.apple.com/us/app/things-3/id904280696?mt=12 – ErfanMHD Oct 10 '18 at 19:38
  • Sorry, little bit of a language barrier. That was just an example, I believe what you're trying to do is get the current version number for the application? You can do that by using `https://itunes.apple.com/lookup?id=904280696` and then I would write some sort of javascript function that looks at and stores the current version number and checks maybe once an hour for a new version and then does what it needs to do. Additionally you can use this method to get new screenshots, new release notes etc.. – MeltedPixel Mike Oct 10 '18 at 19:48
  • For additional information please see, [iTunes RSS API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/) – MeltedPixel Mike Oct 10 '18 at 19:53
  • yes exactly, i have got the current app version, size, title with LookUp API, and i have wrote the review of the last version for now and a post is published in wp with these content. when the app gets a new version on macAppStore the info like version, size or title will be updated automatically cause they are linked to apple. but the review i wrote for the last version is out of date. what i need is a heads up notification that i should update the post cause it has a new version. – ErfanMHD Oct 10 '18 at 20:19
  • i'm not familiar with java script coding that much, if the method u are saying is what i need to get the heads up notification, i'll be really thankful to get more information from you and make it done. cause i've read the iTunes RSS API and i don't know how to do such a thing you are saying Mike :-( – ErfanMHD Oct 10 '18 at 20:22
  • How do you want to display the notification? Wordpress dashboard? A simple link that you can navigate to? Where ideally would you want to be notified. I can think of a few easy ways of doing this. However the only sorta complicated part is being where you want to display the information. – MeltedPixel Mike Oct 10 '18 at 22:40
  • i think the best way is inside wp dashboard. a list of my current post that have to be updated would be great. is it possible ? any chance of response @mike ? – ErfanMHD Oct 14 '18 at 18:41
0

This is a reply to our comment history in the other answer.

@erfanMHD, there are a number of ways to really do this. You don't have to do it in javascript. This isn't really something someone can give you an easy code snippet for since it requires a few additional things and is generally frowned upon in StackOverflow.

You'll need somewhere to store the localVersion of the application of the review you last wrote. In the example I wrote below I used a simple MySQL database to hold the local version. You'll also need to figure out how you want to display the data. I know you can add stuff to the wordpress dashboard but this isn't something we can show you how to do via StackOverflow.

However, below is a very simple (JUST FOR REFERENCE) purposes only on how one could achieve what you're trying to do. However this is just an example to guide you along the process.

For this demo, you'll need a MySQL database with a DBName of test and and a record created called application_version with 3 rows. ID, Name, Version.

<?php
    $servername = "localhost"; // Your MySQL Server
    $username = "root"; // Your MySQL Username
    $password = "password"; // Your MySQL Password
    $dbname = "test"; // The name of your MySQL database
    $id = "904280696"; // The ID of the applicaiton you're wanting to check

    function search($searchTerm){

        // Construct our API / web services lookup URL.
        $url = 'https://itunes.apple.com/lookup?id=' . urlencode($searchTerm);

        // Use file_get_contents to get the contents of the URL.
        $result = file_get_contents($url);

        // If results are returned.
        if($result !== false){
            // Decode the JSON result into an associative array and return.
            return json_decode($result, true);
        }

        // If we reach here, something went wrong.
        return false;

    }

    function updateVersion($id, $name, $version) {

        // Create MySQL connection
        $conn = new mysqli($GLOBALS['servername'], $GLOBALS['username'], $GLOBALS['password'], $GLOBALS['dbname']);

        // Check MySQL connection
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }

        // Save the Version information
        $sql = "UPDATE application_version SET name='" . $name . "', version='" . $version . "' WHERE id='" . $id . "'";
        echo $sql;
        echo "<br>";

        // Run the Insert into MySQL
        if ($conn->query($sql) === TRUE) {

            // Print On Success
            echo "Record Updated Successfully";
            echo "<br>";
        } else {

            // We dun goofed
            echo "Error: " . $sql . "<br>" . $conn->error;
            echo "<br>";
        }

        $conn->close();
    }

    function getLocalVersion($id) {
        // Create MySQL connection
        $conn = new mysqli($GLOBALS['servername'], $GLOBALS['username'], $GLOBALS['password'], $GLOBALS['dbname']);

        // Check MySQL connection
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }

        $sql = "SELECT * FROM application_version WHERE ID = " . $GLOBALS['id'];

        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            echo "Found Application ID Entry in database";
            echo "<br>";
            echo "<table><tr><th>ID</th><th>Name</th><th>Version</th></tr>";

            // output data of each row
            while($row = $result->fetch_assoc()) {
                echo "<tr><td>".$row["id"]."</td><td>".$row["name"]."</td><td>".$row["version"]."</td></tr>";
                $GLOBALS['storedVersion'] = $row["version"];
            }
            echo "</table>";
            echo "<br>";

        } else {
            echo "No Application ID Entry found in database";
            echo "<br>";
        }


        $conn->close();
    }

    // Search for your requested ID
    $searchResults = search($GLOBALS['id']);
    $currentVersion = '0.0.0';
    $storedVersion = '0.0.0';
    $appName = 'null';

    // Loop through the results.
    foreach($searchResults['results'] as $result){

        // Pass the current version to variable
        $currentVersion = $result['version'];
        $appName = $result['trackName'];

        // Get the current version or what ever else information you need
        echo 'Current Version: ' . $currentVersion;
        echo "<br>";
        echo "<br>";
    }

    // Get Local Version from database
    getLocalVersion($id);

    if ($currentVersion > $storedVersion) {
        echo "You have an old version friend";
        echo "<br>";

        // Write what you want it to do here

        updateVersion($id, $appName, $currentVersion);
    } else {
        echo "You're all up to date";
        echo "<br>";

        // Write what you don't want it to do here
    }
?>

Again, this is just quick and dirty. You'd want to do a lot of additional checks and balances. One I see right off the bat would be in the check for inserting.