Automatic Signup for ACRCloud Trial
 Page :   [ 1 ]    [ 2 ]    [ 3 ]    [ 4 ]    [ 5 ]  

My girlfriend often uses an app called Shazam to identify music being played in various places (Bars, Bowling alleys etc.).  It inspired me to take a look at implementing similar functionality into a Youtube video downloader app I made for her (not in app store due to their policies) some time ago.  I figured by now there has to be some super easy API out there for doing such a thing.  Turns out there's one at ACRCloud.com that has a free trial and also a sample iOS app downloadable with their SDK.  The sample app compiled right away and it worked as advertised!

Then I thought wouldn't it be interesting to automate the signing up for the free trials thus not having to pay for the service.  Here's the result (somewhat ugly but functional).

I should note that I *DO* intend to pay for their service which is very cheap at $3/1000 requests.  I only did this as an interesting exercise :)

The first thing to do is make a catchall on my mail server to have all the signup responses funneled to. I just created a local user called "catchitall".

The configuration of Exim is pretty straight forward.

I created this file :

/etc/exim4/conf.d/router/440_custom-catchall_acrcloud

 

and put the following into it:

catchall_acrcloud:
  debug_print = "R: catchall_acrcloud $local_part@$domain"
  driver = redirect
  local_part_suffix = .acr
  data = catchitall@YOURDOMAIN.com
  retry_use_local_part

 Note: you must have told Exim during setup to split the configuration up into small files (as opposed to one large file) in order for it to use this router.

On Debian I run the following to reconfigure Exim.

dpkg-reconfigure exim4-config

 

In the home directory of the "catchitall" account I made the following files.

.forward : this file will tell the system to send any incoming mail to process.php to be handled.

start.php : this file is called via cron every 13 days to start the process of creating a new account on ACRCloud.com

process.php : this file is used to process the incoming confirmation email sent to us after signing up (as specified in .forward).

 

The contents of the .forward file are:

|/home/catchitall/process.php,\catchitall,myemail@example.com

This will send the mail to be processed by process.php as well as save a copy in the local mail directory and also forward a copy to my personal email just for monitoring purposes.

 

On the next page we look at whats in start.php..

 (Page 1 of 5)