How best to deliver notifications to various IM / notification services? - php

We have a website which provides time-critical updates on changes in the value of FOO, and want to deliver notifications of new data via various IM protocols.
For reasons best known to themselves (and their parents), the FOO-traders use Yahoo! Messenger, MSN, gTalk, AIM, you name it. They want to receive their updates on their desktops so they can buy and sell FOO realtime.
We want to deliver the updates to them via the various networks, without investing a huge amount of time in supporting new networks.
I'm aware of services like RPX (or whatever it's now called) and Gigya, which allow you to authenticate across multiple websites. I want something similar, but which allows us to deliver IM to the same various networks.
The service should be able to readily expose access to notifications coming from a PHP (Drupal 7) website.
The website is a paid subscription service; we are not after a cross-network spam solution. I say this (1) so you won't hate me (2) because if we wanted to send spam, that would probably preclude gateway providers.
Self-hosted solutions like PHPurple are an option also, but I haven't found much online to recommend it as an option yet.
Support for other networks will be a bonus, although I haven't seen any of the FOO-traders use Twitter yet. We will also include SMS and email notification for added old-school cred.

Through Jabber server.
Set up Jabber server
Register accounts for all the services you going to use
Register gateways, all jabber servers support them
Test through GUI jabber client
Write a daemon (or get somewhere), which logs into jabber, starts up gateways, reads messages from somewhere and sends them right away.
There are command-line utilities, but they won't work, because server won't keep gateways connected unless on it's own.
XMPP protocol is quite straightforward and has many libraries.
For reliable SMS you might need to use other, 3rd party protocols or utilities.

Related

Create web service for notification purpose?

I have built an ecommerce website in CakePHP and MySQL which takes orders and stores them in db. I've been told that I need to create a web service for sending notification to desktop/via email which would alert us of any order given instantly and would also provide us with order details. Do i need to study up on web services, SOAP, GET POST etc. or can I do it with some easier method? What would be a secure and fast response way of receiving such a notification from the web application? Thanks in advance :)
A webservice would be useful the other way round. If a third-party entity wishes to access your website as a service without accessing HTML pages, yes in that case, creating a webservice on your end will be useful.
I recommend you for instance to see the RESTful webservice interface to stackoverflow/stackexchange itself to understand this concept: https://api.stackexchange.com/docs.
In your case, I can't see how webservices would be involved. If you just need to send emails from your website, it can be done directly with the PHP mail() function, or using a mailer like PHPMailer.
Desktop notifications are an entirely different matter, because you need a client software.
I haven't dug pretty far in that topic myself, but here are a few pointers:
A popular Desktop Notification software for MacOSX is Growl which has been unofficially ported to Windows: http://www.growlforwindows.com/gfw/
There is a PHP API to send messages to Growl clients: http://clickontyler.com/php-growl/.

Can i use Google App Engine as a replacement for Google Apps to send email from php-driven webapp?

Righty, I'll use bullets to make this as clear as possible!
My application lives on my server (and doesn't use G.A.E)
Currently I use Google Apps (paid) as my mail server in PHP, it's great but...
It's limited to ~2000 emails per day, i need to send more in the forthcoming version of my web app.
.
Can i use GAE's just for emailing via their remote api?
Can i view the sent/received email in Gmail like i can with Google Apps?
Am i totally barking up the wrong tree?!
Yes you can send emails from GAE, even in PHP. You need a valid Gmail or Google Apps account to use as sender address.
Things to note:
The cost of one email is $0.0001.
The size of sent/received emails add to the bandwidth cost.
There are quotas, varying for free apps and billable apps. Free
app limit is 100/day, billable app quota is 20,000/day. (You need to
pay the first bill in order to go beyond free quota limit, even if
you already enabled billing). You need to have premier account to go
beyond 20,000/day limit (they might approve it without premier
account if you ask them.
There are technical limits.
No, emails sent from GAE do not show up in senders outbox.
Update: GAE can send emails and is pretty good at that. But it's not a generic SMTP server, so it's not a drop-in replacement for services like mailgun. Also it does not do "value-added" mail services, like maillist management, tracking, etc.. This is all doable but you have to code it yourself.

PHP to Quickbooks - how do I connect the two if she's running on a desktop?

I'm tasked with coming up with an e-commerce solution for a small, local business. My client uses Intuit/Quickbooks point of sale software. I've just discovered that Intuit has a series of PHP 5+ classes that allow interoperability (link for anyone else that may stumble on this: https://code.intuit.com/sf/sfmain/do/viewProject/projects.php_devkit).
The website will be hosted on shared hosting, so the two systems are split quite literally. Her desktop does have internet access.
So, my questions:
Is there a way for me to connect to her desktop via curl?
If so, is there a way for me to do it securely if I can't create a VPN on my host?
Now that I think about it, is there a VPN service I could use?
Any other security things I should be aware of?
Payment processing will be handled through Stripe (http://www.stripe.com). This is really just for inventory/order synching.
Your best bet is the QuickBooks Web Connector, along with that set of PHP classes you mentioned. See my specific comments below:
I've just discovered that Intuit has a series of PHP 5+ classes that allow interoperability (link for anyone else that may stumble on this: https://code.intuit.com/sf/sfmain/do/viewProject/projects.php_devkit).
It's worth noting that that library is NOT developed by Intuit (disclaimer - I'm the developer of that library). Intuit hosts our Subversion repository, but we're a separate company, and Intuit does not contribute to the actual PHP code. Intuit provides a Windows COM-based API only, we provide the actual PHP components so you can talk to QuickBooks from a remote server via the Web Connector, without the need to muck with COM.
We have a ton of information on our QuickBooks integration wiki which might be helpful - specifically the QuickBooks integration with PHP section and this overview of the QuickBooks Web Connector.
Consider grabbing the latest nightly build from the link you posted, and taking a look at this file:
* docs/example_web_connector_point_of_sale.php
It illustrates exchanging data between PHP and QuickBooks Point of Sale.
The website will be hosted on shared hosting, so the two systems are
split quite literally. Her desktop does have internet access.
This ^^^ is just fine, and a typical scenario. It's exactly what the Web Connector was designed for. The Web Connector essentially acts as a "dumb proxy" between a PHP SOAP service, and QuickBooks itself - it relays messages from your PHP app, over HTTP(S), to QuickBooks.
Is there a way for me to connect to her desktop via curl?
Not with Curl, no (though you could build one... but why reinvent the wheel?). The Web Connector is SOAP based, but your PHP components will be the SOAP server half, not the SOAP client half.
If so, is there a way for me to do it securely if I can't create a VPN on my host?
The Web Connector can use SSL via HTTPS to keep the data secure while in transit across the net.
Now that I think about it, is there a VPN service I could use?
Just buy an SSL certificate, it's easier. :-)
Any other security things I should be aware of?
Not beyond the typical web application security guidelines that you could find elsewhere on Stackoverflow.
If you're going to sync to a system like Quickbooks, don't do it real-time, do it in a batch process that is resilient to things like her desktop being turned off, the crappy office internet (compared to a datacenter) being slow or down, etc.
This ^^^ is great advice, and is exactly how the Web Connector works.
If you need real-time, Quickbooks running on a desktop is NOT the way to go.
In fact, if you need real-time, QuickBooks period is not the way to go. QuickBooks is a great small to medium business accounting software... but is slow and not reliable enough for consistent real-time communication. With that said... what you're talking about does not require real-time communication, so this shouldn't bother you.
Batching the orders isn't a problem, but how would I make even a batch process resilient?
The PHP code uses a queue with a status, so you can track what got processed, what didn't, what you got back from QuickBooks as a response ("Added a customer successfully!" vs. "Ooops, failed to add a customer because ..."), what error messages QuickBooks threw, etc. and then react appropriately with your code, or manually.
You won't need cron - the Web Connector can be scheduled to run, and it'll relay all errors and a ton of other information back to you so that you can handle errors, send out warnings, build reports to show to people about what failed/succeeded, etc.

Sending MP3 over the internet to a phone via GSM

How do i send an MP3 file to a mobile phone directly from the internet over a GSM network, Will love to implement this using PHP, every response will be appreciated. Thank you.
Afaik, you need to use a Content Delivery Platform of a GSM provider for this.
I remember researching this a couple years back when mobile content, especially ringtones, had been all the rage. Things might have changed since then (especially with phones having WiFi access), but you had to have a contract with someone that actually has access to the GSM network to send the mobile content to cellphones.
You'd then use this providers API to manage your content and to send it to devices. For instance for the german Deutsche Telekom, there is a Zend_Service package that allows you to use some of their telecommunication services (for a charge). This particular one doesn't allow sending of digital content like MMS or MP3s, but it might given you an idea what to look for.
Edit: try googling for MMS Gateway and check with your country's GSM providers
directly from the internet over a GSM network
GSM is a low level network protocol, while it is possible to write a stream directly to a port on the device (yes, it uses ports, just like IP) or even compose individual packets, this pre-supposes that you have access to a gateway device in order to do this from an IP connected device. Why bother? It'd be really hard to find a phone which does not support WAP or iMode made in the last 10 years - and there is already an infrastructure and protocols in place to map the internet into the mobile networks (regardless if they are GSM, GPRS, Edge...).
And of course, unlike using a browser on your PC, the WAP protocol allows for push notifications - but this requires the services of a wap gateway (e.g. Kannel) rather than just a simple website.
This would deliver the content as a file if you want to stream audio over a telephone conversation - that's something different. Have a look at VOIP/PBX systems e.g. Asterisk
From the comments I am guessing you want to exchange sound files between two people, one on an ordinary Internet connection, the other on GSM. Or else you could just design a mobile-friendly web site where GSM/GPRS users can download their music.
Under this assumption, XMPP (a.k.a Jabber) might be a solution.There are even XMPP libraries for JavaME and most certainly for iPhone and Android. Of course, both users must have an active Internet connection.

SIP subscription in PHP

I have several Snom VoIP phones in the office running off a virtual phone system in London somewhere.
I've written a small PHP app that lets me control the phone remotely - all it does in the background is cURL into my handset's web interface and control it that way.
However now I'd like my PHP app to know what other phones on the system are available/busy. I think the phone handsets do this by way of a SIP subscription with the virtual phone system, whereby my handset subscribes to feeds from all other handsets on the system and can then light/extinguish the busy lamp.
Am I going about this the right way? Is there any way I can have a PHP script subscribe to those notifications?
Many thanks in advance
This is not likely, but really depends on what you mean by a "PHP app". If it's a standard web-based application, you can't do anything about it. SIP communication is done over UDP sockets and requires you to listen all the time for responses.
If you mean an actual application, running all the time, then you need to implement the SUBSCRIBE/NOTIFY part of SIP spec and it is of course possible.
If you want to pull the statuses of other phones into your web application, I'd recommend setting up a server which will handle the standard SIP communication and subscribe to the phone's presence, then update the information in a local database. In the web app you can simply read the current status from the database and present it to the user.

Categories