You can host it on any apache server running php. Apache and PHP are available in OS X, but I've never used the natively available server so I can't offer much guidance there. You'd also then have to open up your Mac on your network so that the iPhone could actually reach the php script.
Ok, so two parts:
1. a PHP script that actually pulls from Apple and reformats the feed to make it more digestible. I did this externally because I didn't feel like fighting Swift to parse complex JSON. I was hosting this on an internal server, so you'll have to toss it somewhere.
http://pastie.org/private/c3hh1hum8fgfgc5moq4g
2. Here's the Xcode project. You'll need to replace the URL in APIController.swift with wherever you put the PHP script above.
https://www.dropbox.com/s/ovresoglewyvdhp/iPhoneChecker.zip?dl=0
None of this is guaranteed to be useful or bug free or with any kind of warranty. This was just something I intended to use for myself, so the code is not perfect, there are barely any comments, and I've only tested it with one device. Good luck.
You can host it on any apache server running php. Apache and PHP are available in OS X, but I've never used the natively available server so I can't offer much guidance there. You'd also then have to open up your Mac on your network so that the iPhone could actually reach the php script.
Thanks. So I know client code but am totally novice to php and hosting a script. How/where would I host this. Possible to just host from my Mac?
Thanks. This article helped me with getting Apache and PHP up and running on my Mac.
http://ole.michelsen.dk/blog/setup-local-web-server-apache-php-macos-x-mavericks/
Script works great!
thanks for the code, hosted the php code you posted onto my webserver with my zip code entered, and models I'm looking for. Is there any way to just show 3-4 nearest stores, instead of 20?
I'm just a layman ...
Is there any way you or a MR member can upload the script and allow Macrumors users to use it by inputting ZIP Code ?
Of course wouldn't advise publishing live as could bring too much traffic (if that's not what you need!)
Ok, so two parts:
1. a PHP script that actually pulls from Apple and reformats the feed to make it more digestible. I did this externally because I didn't feel like fighting Swift to parse complex JSON. I was hosting this on an internal server, so you'll have to toss it somewhere.
http://pastie.org/private/c3hh1hum8fgfgc5moq4g
2. Here's the Xcode project. You'll need to replace the URL in APIController.swift with wherever you put the PHP script above.
https://www.dropbox.com/s/ovresoglewyvdhp/iPhoneChecker.zip?dl=0
None of this is guaranteed to be useful or bug free or with any kind of warranty. This was just something I intended to use for myself, so the code is not perfect, there are barely any comments, and I've only tested it with one device. Good luck.
FYI to people out there wanting to buy a plus. Check Craigslist. I found two ads for an iphone plus priced about $50-$100 over what the store will charge after tax. Negotiate a little bit and you might not have to pay too much over retail price. I really hate doing that, but at the same time how much time am I wasting trying to find a damn phone? Time is money for me. Craigslist has it's risks, but if you meet at the carrier store and they verify it, you really have nothing to lose. Open the box, turn it on, verify it, then they get the cash. I might go this route.
FYI to people out there wanting to buy a plus. Check Craigslist. I found two ads for an iphone plus priced about $50-$100 over what the store will charge after tax. Negotiate a little bit and you might not have to pay too much over retail price. I really hate doing that, but at the same time how much time am I wasting trying to find a damn phone? Time is money for me. Craigslist has it's risks, but if you meet at the carrier store and they verify it, you really have nothing to lose. Open the box, turn it on, verify it, then they get the cash. I might go this route.
ads in upstate NY are crazy. People are wanting $1500+
Super! But I'm noob in PHP, how do you limit results to first 3 from ZIP code?
7 words for everyone regarding hosting:
aws free usage tier t2.micro instance
You'd have to create a counter and increment it inside this for loop:
foreach ($data['body']["stores"] as $store)
Once you reach the desired number of stores, you could add a break.
if (isJson($json)) {
$data = json_decode($json, true);
[B] $i = 0;
[/B] foreach ($data['body']["stores"] as $store) {
[B]$i++;[/B]
foreach ($store["partsAvailability"] as $partNum => $partAvailability ) {
$results_array["parts"][$parts[$partNum]]["stores"][] = array(
'store_name' => $store['storeName'],
'available' => ($partAvailability["pickupDisplay"] == "available") ? 1 : 0,
);
}
[B] if ($i == 3){ break; }[/B]
}
ksort($results_array["parts"]);
}
apple.com/iphonewhere is the link to reserve and pick up in store tomorrow?
apple.com/iphone
So I loaded both the Rideau and Bayshore stores and going both had 64gb 6+ available in all three colours. I then login to make the reservation and the system tells me none are available when selecting the model I know was just there! I then log back out and check the inventory again only to see the same availability. I cannot for the life of me get a reservation. I think I'm done playing this ******** game...