Oct
29

eBay Tool that Texts Your Cell Phone on New Buy-it-Now Auctions

"This the season to be jolly!" Wait a minute! In the midst of the global economic downturn, how can anybody - except of course for those top-level corporate executives with hefty bonus packages - be “jolly” this season? I personally know of people - including myself - who have lost thousands of dollars in investments.

Ironically today, my PDA reminded me with its yearly recurring alert to beat the Christmas rush and buy presents early. Hooray for even more expenses! I hate to be a Grinch, but it's hard to even think about gift giving in this economic crisis.

Cut Corners with eBay

But, you've got to make do with what you've got, right? Some people will turn to plastic. However, with the financial scare, there will be less credit to go around. Therefore, since many people will be paying with actual money, it's imperative that they get the best bang for their buck. eBay is the perfect place for that. Think about it. On-the-side eBay sellers will emerge from dormancy and start listing items to supplement their income. Even better, there will be fewer buyers in the market because they're holding on to their money … except smart people like you! It's a great scenario of supply and demand where potential buyers win!

 

Missed Buy It Now eBay Auction Listings

eBay's completed listings is useful to check out because you can see what kind of items your money can fetch. However, I have a love/hate relationship with completed listings. While it is useful in gauging the market, I don't want to know that I've missed another a once-in-a-lifetime deal. Looking at completed buy-it-now listings, I occasionally think, "Damn, if I wasn't in class I could've gotten that!” or "Why was I watching TV when this item was listed!?” It seems the only way to avoid losing out on a buy-it-now steal is to constantly sit at your computer and hit the refresh button every minute!

Script with eBay's Shopping Query API

But, that's no fun. It doesn't have to be like that. Don't chase the eBay search. Let the eBay search come to you. I was tired of regretting missed deal after missed deal. And I was through with relying on eBay's heavily delayed "Saved Search" daily email subscription and buggy RSS search feed. So, I rolled up my sleeves and wrote my own program to essentially "hit the refresh button" for me.

Basically, this script obtains search results by utilizing the eBay's Shopping Query API. Every time there is a new Buy It Now listing that matches my criteria, I receive a text on my phone with the price and the listing title. If the item looks promising, I drop everything I do, dash to a computer, review the full description, and buy the item.

Setup

Initial installation is a bit technical, but it's worth it! Once, you've finalized your setup, creating and suspending subsequent search notifications will be a breeze!

  1. First, you have to make sure that you have access to a server that supports cron jobs, a variant of wget, and PHP. If you're using cPanel or something similar, everything is taken care of.
  2. Obtain a free AppID from eBay Developers. This will give you access to their API and database.
  3. On your server, create a folder containing an empty PHP file. Set the folder with writable permissions for everyone or just chmod to 777.
  4. Insert this code into the PHP file and replace "INSERT-YOUR-OWN-APPID-HERE" with your AppID, "PHONE-NUMBER@messaging.sprintpcs.com" with the target email address (or the cell phone's email address), and "EMAIL-ADDY@DOMAIN.com" with the email address you want displayed in the "From" header. The later email address is not really essential. You can even type in a dummy address.
    PHP:
    1. ///////////////"POST" TEST//////////////////////////////////////
    2. if ((empty($_GET["run"])) || ($_GET["run"] != "true")) { echo "Nothing to run!"; return;} 
    3. ///////////////VARIABLES//////////////////////////////////////
    4. $to      = 'PHONE-NUMBER@messaging.sprintpcs.com';
    5. $header = 'From: EMAIL-ADDY@DOMAIN.com' . "\r\n" .
    6. 'X-Mailer: PHP/' . phpversion();
    7. //Need a Worldwide function when neccessary
    8. //////////////////////////////////////////////////////////////////
    9. foreach ($calls as $parms) {
    10. $nickname = $parms[0];
    11. $safeQuery = $parms[1];
    12. $descflag = $parms[2];
    13. $categ = $parms[3];
    14. $priceRangeMin = $parms[4];
    15. $priceRangeMax = $parms[5];
    16. $results = '';
    17. $endpoint = 'http://open.api.ebay.com/shopping';
    18. $currIDs = "";
    19. $apicall = "$endpoint?callname=FindItemsAdvanced"
    20. . "&version=537"
    21. . "&siteid=0"
    22. . "&appid=INSERT-YOUR-OWN-APPID-HERE"
    23. . "&QueryKeywords=$safeQuery"
    24. . "&MaxEntries=200"
    25. . "&ItemSort=PricePlusShipping"
    26. . "&CategoryID=$categ"
    27. . "&ItemType=AllFixedPriceItemTypes"
    28. . "&PriceMin.Value=$priceRangeMin"
    29. . "&PriceMax.Value=$priceRangeMax"
    30. . "&DescriptionSearch=$descflag"
    31. . "&IncludeSelector=SearchDetails"
    32. . "&responseencoding=XML";
    33. $resp = simplexml_load_file($apicall);
    34. if(!file_exists("$nickname.txt")) {
    35. $fp = fopen  ("$nickname.txt", "a+");
    36. fwrite($fp,"//////////////////////////////////\n");
    37. fclose($fp);
    38. chmod("$nickname.txt",0777);
    39. }
    40. $prevIDs = file_get_contents("$nickname.txt");
    41. if (!$resp || $resp->TotalItems == 0) {
    42. //echo "No Items for $nickname!";
    43. break;
    44. }
    45. if(count($resp->SearchResult->ItemArray->Item)> 10) {echo "Max Entries Exceeded for $nickname!"; break;}
    46. foreach($resp->SearchResult->ItemArray->Item as $item) {
    47. if(!strpos($prevIDs,(string)$item->ItemID)) {
    48. $currIDs .= $item->ItemID . "\n";
    49. if (sprintf("%01.2f", $item->ConvertedBuyItNowPrice) == "0.00") { $binprice = sprintf("%01.2f", $item->ConvertedCurrentPrice)}
    50. else { $binprice = sprintf("%01.2f", $item->ConvertedBuyItNowPrice); }   
    51. mail($to, "", "BIN Notification for '" . $item->Title . "' (".(string)$item->ItemID.") - $" . $binprice, $header);
    52. }
    53. }
    54. if (!empty($currIDs)) {
    55. $currIDs .= "////////////////////////////\n";
    56. file_put_contents("$nickname.txt",$currIDs,FILE_APPEND);
    57. }
    58. //var_dump($resp->SearchResult->ItemArray);
    59. //echo $currIDs;
    60. }
    61. ?>
  5. Now, you need to specify your search calls. The search call follows this format:
    PHP:
    1. $calls[] = array(0 => "SEARCH TERMS", "DESCRIPTION BOOLEAN",CATEGORY_NUMBER,MAX_PRICE,MINIMUM-PRICE);
    • Replace "SEARCH TERMS" with the actual terms you type into the eBay search form like "ipod." Make sure you escape quotes if you search with exact phrases.
    • For "DESCRIPTION BOOLEAN," specify "true" to search within the item's description or "false" to restrict the search to the title. Remember to include the double quotes.


    • If you want to restrict search to a specific category, replace "CATEGORY_NUMBER" with the appropriate eBay category ID. To find this, you'll have to view the HTML source code of the category's page. Pretend you want to restrict the search to the Cell Phones & Smartphones subcategory. Visit the page of the category in eBay and view the HTML source. Search for "tcat=" (without quotes) and the next number should be the category ID.
    • The last two fields are just for the minimum and maximum price. I think they're pretty self-explanatory. Remember to exclude the currency (dollar) symbol!

    To give you an example, the following is one search call I currently keep on my watchlist.

    PHP:
    1. $calls[] = array(0 => "touchI","\"touch pro\" (sprint,nextel)", "true",3312,0,500);

    You can add as many $calls lines as you want. When you are finished with one, just comment out or delete the line.

  6. Save the script and do a manual test run in your browser window. Then, check your email account to verify that you received something. I suggest you first perform a search on eBay and verify that there are a few search results so that you don't end up with a flooded or empty inbox. Also, make sure you append "?run=true" after your test URL. It's a mechanism I implemented so that search engines or wandering visitors don't accidentally run the script. If it works, great! If not, check your PHP error log or shoot me a message.
  7. Now that it works, program your server to automatically execute the script. Setup a chmod to automatically open the PHP URL?run=true. I set mine to run every 10 minutes. Depending on your server load, you may want to set the cron job to recur more or less.

Caveats

Now, there are a couple of miscellaneous things you should know when using this script.

  • First, there are no repeat notifications. Once the script sends an alert to your email address or cell phone, it will not happen again. So, if the seller lower the price on an item you received an alert on a week ago, you won't know about it unless you pull up a complete list of search results on eBay.
  • This script only works with Buy it Now items. You can modify "&ItemType=AllFixedPriceItemTypes" to do otherwise but I didn't see any reason to do that when I wrote this script.
  • Unless eBay checks your code, your AppID is limited to sending 5000 calls to the eBay API. Keep that in mind if you decide to run this script every minute with 5 queries at a time.
  • I've implemented a control mechanism to withhold sending notifications when matching items is greater than 10. You can change this on the line that contains:
    PHP:
    1. if(count($resp->SearchResult->ItemArray->Item)> 10) {echo "Max Entries Exceeded for $nickname!"; break;}"

    Just a warning, when I didn't add this control sequence, I accidentally sent 200 text messages to my phone. Needless to say, I'm now on the unlimited texts messaging plan. Luckily, my host and the Sprint email servers didn't flag me as a spammer … yet. :)

  • That leads me to my next warning. If you're going to send notifications to your cell phone, don't subscribe to the 300 text messages per month plan. You'll thank me later.
  • Lastly, feel free to customize this script and add your own search parameters. I know many of my readers reside out of the United States. Play around with the "&siteid=0" parameter. The eBay API is so flexible. Your tenacity and coding skill are the only things holding you back.

So, give the script a whirl! You'll be the first buyer to see the next Buy-it-Now deal and you'll have a competitive edge over the eBay market this holiday season. I'm only a comment or email away. Tell me about your experience with this script!

If you enjoyed this post, make sure you subscribe to hacker not cracker via RSS feed or email update!



Additional Reading

Comment View Comments from Other Readers

Popular Posts

Featured Posts

Related Posts

Recent Posts

What's Your Reaction?


Subscribe to this Blog:

Reader Reactions Elsewhere


 

9 Responses to “eBay Tool that Texts Your Cell Phone on New Buy-it-Now Auctions”

  1. Shane Says:

    Been looking for something like this for a while, but dont seem to be able to get it working. Looks like it may have something to do with ebay changing the api? Trying to get it working for ebay.co.uk...

  2. Edwina Says:

    Great article. I will be dealing with a few of these
    issues as well..

  3. www.hummaa.com Says:

    It's a pity you don't have a donate button! I'd definitely donate to this superb
    blog! I suppose for now i'll settle for bookmarking and
    adding your RSS feed to my Google account. I look forward to fresh updates and will
    share this website with my Facebook group. Talk soon!

  4. Sheena Says:

    There are a number of factors that are likely to contribute to the continuing popularity of paraffin
    as a source of energy for domeestic properties. Most thieves are opportunistic and will look
    for an easy target. Among all types of fuel used fordomestic use, home heating oil is one of the popularly used form of crude oil.

  5. Becky Says:

    Kleftiko - Authentic Greek Kelftiko is lamb cooked
    to the point that the meat just falls off the bone.
    Over 30 species of whales, dolphins and porpoises ply the waters
    of the Great Barrier Reef and over 200 species of birds
    nest or roost onn the islands. ) Wash your face and shoiwer right after exercise of any kind.

  6. icd 9 pelvic pain Says:

    Good answer back in return of thijs question with solid arguments and telling everything concerning that.

    Feel free to surf to my blog: icd 9 pelvic pain

  7. dr oz pure garcinia cambogia side effects Says:

    Hi, this weekend is nice in support of me, because
    this occasion i am reading this wonderful informative article here at my house.

  8. garcinia max fat burn cleanse Says:

    Hmm it seems like your bloog ate my first comment (it
    was extremely long) so I guess I'll just sum it up what I wrote and say, I'm thoroughly enjoying your blog.
    I too am an aspiring blogg writer but I'm still new to the whole thing.
    Do you have any tips for inexperienced blog writers? I'd really appreciate it.

    my website; garcinia max fat burn cleanse

  9. good used car dealerships Says:

    These companes offfer a wide range of used four wheelers to suit the need of buyers without deep pockets.
    A tractor is a heavy powerful vehicle that is mainly used in farming and construction.

    Look for recalls, consumer reviews, and pricing information.

Leave a Reply

 
Latest Post on Loading...: Please Wait...
admin admin
© 2006 and web design of Allan Ray Barizo from [art] [⁄app].
This site is best viewed with FF and at least 1024x768 resolution.