what is the best way to retrieve id from itunes app link?
let say i have these link:
http://itunes.apple.com/us/app/bring-me-sandwiches!!/id457603026?mt=8
http://itunes.apple.com/us/app/bring-me-sandwiches!!/id457603026
i just want to get the id, 457603026 using php preg_match
From the menu bar at the top of your computer screen or at the top of the iTunes window, choose Account > Sign In. Then click Create New Apple ID. Enter your credit card and billing information, then click Continue. You can also choose None, and learn what to do if None isn't showing or you can't select it.
An Apple ID is the email address you use as a login for just about everything you do with Apple, including using iCloud to store your content, buying songs from the iTunes Store, and downloading apps from the App Store. An iCloud account, iTunes account and Apple ID are all the same thing.
The quickest way to get a link is to Control-click or right-click on a song in the iTunes Music Store. A contextual menu pops up. Select Copy iTunes Music Store URL and simply paste the URL into an email or HTML page.
Without preg_match:
$url = 'http://itunes.apple.com/us/app/bring-me-sandwiches!!/id457603026?mt=8';
echo end(explode('/id', parse_url($url, PHP_URL_PATH)));
or, if you prefer:
$url = 'http://itunes.apple.com/us/app/bring-me-sandwiches!!/id457603026?mt=8';
$id = explode('/id', parse_url($url, PHP_URL_PATH));
echo $id[1];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With