integrating php mysql and voip and text to speech - php

Im looking for a starting point of writing an application that will allow a php/mysql program to interact with a VOIP caller(s).
The idea is caller calls into a number, and that number reads text output from php/mysql based on menu options on the call.
Where do i start with this project? Specifically, getting the voip to interact with the php.

www.voicePHP.com

You might want to look into Twilio's service too. Language-agnostic, simple REST API, reasonable pay-per-minute cost, very robust and scalable. There are some examples in the documentation that get you started towards doing what you want.

Related

Sending a notification of a Paypal transaction to an IRC Bot, either directly or via intermediary webpage

Firstly this is my first question so I apologize if it not up to standards.
TL:DR -
I need to be able to get a notification of a Paypal transaction with the amount, and message, if any to an IRC bot. I am thinking about a webpage to take the transaction and notify the bot. I was hoping to use PHP for the webpage and this for the IRC bot: willie.dftba.net - An open source Python IRC Bot.
Long Format -
Context:
I am attempting to create a webpage that will take a Paypal transaction, then send a notification containing the amount and the message the user left(if any) to the IRC Bot.
The reasoning behind using a webpage over having the bot query the Paypal API directly is to avoid spamming Paypal while at the same time reducing the communication to a notification only when an event occurs.
The webpage will likely be running on a hosted webserver that I have little control over. I am familiar with PHP, my Javascript is not so great though.
The IRC bot has not yet been created, I was hoping to utilize willie.dftba.net for the bot, it's Open source and in Python. The bot will be running on a Windows machine most likely. Other options for IRC bots should probably be left to the comments. The bot will be doing other things outside the scope of this question. Though this is a critical function for the bot.
Answers I'm looking for:
What sort of technologies or libraries for the languages I am trying to use can help me achieve this as simply as possible? Please state why.
Suggestions that are within the scope of this question:
Using different technologies, languages, or APIs than I mentioned if it will make the job easier/faster. Please state why.
Why am I asking?
I am asking this question because there seems to many possible technologies or APIs I could utilize but I am not experienced enough to ascertain which route I should head down. I am honestly at a loss right now.
Background on my Knowledge & Experience:
For web technologies, I am familiar with HTML, PHP CSS, & a little Javascript.
For programming languages I have taken a few classes covering basic C++, Visual Basic .NET, and some Java.
I have messed around with Python a little over a decade ago when modding a game.
I have created, or helped to create a dozen or so smaller websites. I have used things like Jquery before but in an extremely limited fashion, my PHP is much stronger than my Javascript.
I have made a few simple command line C++ & Java programs as learning exercises.
I have made many simple VB.NET applications and 3 practical use, but small applications.
Research I have conducted:
I have searched Google, and here for possibilities, and have several links that I have looked through. While I must admit I have not read every single word on every single link, I have read a fair portion and skimmed a lot of the rest. And clicked on many links within the pages I am about to reference here. For the sake of not posting the entire internet, I am only posting the starting links.
After typing this all up, I discovered it will not let me post more than two links so I have had to alter these links.
willie.dftba.net
php.net/manual/en/book.sockets.php
socket.io
www.npmjs.com/package/socket.io
stackoverflow.com/questions/6398887/using-php-with-socket-io
www.htmlgoodies.com/html5/other/create-a-bi-directional-connection-to-a-php-server-using-html5-websockets.html#fbid=XmAMX7ESMm7
stackoverflow.com/questions/14418950/broadcast-notification-to-multiple-users-at-the-same-time-php-mysql-ajax
cometdaily.com/maturity.html
stackoverflow.com/questions/12284565/how-to-communicate-between-a-php-and-a-c-application-through-a-socket
davidwalsh.name/nodejs-irc
sourceforge.net/projects/phpsmartirc/
Final Thoughts:
Thank for reading this question and devoting some of your time and energy to this question, it is highly appreciated! I really hope I have been thorough & specific enough.
You've been pretty broad with your questions, so I'll be broad with my answer.
I would recommend sticking with PHP and setting up an Instant Payment Notification (IPN) solution for your PayPal account.
That will send POST data about any transaction that hits in your PayPal account in real-time. You can use it to automate tasks based on payments, refunds, disputes, cleared payments when they're pending, etc.
There are lots of good IPN packages for PHP available on GitHub/Packagist. If you happen to be working with WordPress, take a look at my PayPal IPN for WordPress plugin, and on that note, if you are using WordPress I'll assume you're using WooCommerce, so I'd also take a look at my PayPal for WooCommerce plugin.
For API calls, I would recommend taking a look at my class library for PayPal. It will make any API call you need to make with PayPal very quick and easy, and it is also available on GitHub and Packagist.
Those tools should give you everything you need to get any PayPal task you need done.

PHP Web Service

I am new to the world of PHP and coding as those have helped me answer a number of questions I have posted know. I have the opportunity to jump into the deep end however seeing I have no clue about PHP and web services, I am seeking your help. I would appreciate it if you could point me in the right direction as I have not been able to find any examples nor detailed information regarding it.
Effectively there is a PHP page that needs to pass certain values to a .NET web service i.e. name, email, mobile number and upon the receipt of such information the web service sends out a text message. This is information I have so far
The Allocation service uses a basic HTTP binding and TransportWithMessageCredential security.
Sample C# code using a reference generated with Visual Studio tooling
Allocation.AllocationServiceV3Client Client = new Allocation.AllocationServiceV3Client();
Allocation.AllocateResult Result;
string VoucherCode;
DateTime ExpiryDate;
string DisplayMessageText;
Client.ClientCredentials.UserName.UserName = ? ;
Client.ClientCredentials.UserName.Password = ? ;
Result = Client.AllocateToConsumerMobileAndSendSMS(out VoucherCode,
out ExpiryDate,
out DisplayMessageText,
ClientID,
ClientReference,
CampaignID,
ActivityID,
MobileNumber);
if (Result != Allocation.AllocateResult.Success)
{
}
I have no clue about PHP and web services
First things first, pick your brain up out of the C# soup and sit it out to dry off for a few hours. PHP is a simple language for simple things. If you're new to it, you don't want to try and make it do complex things, and you certainly don't want to try writing C# style code in PHP.
Let's take "web services" as an example of a "complex" thing. In some circles, this means horribly designed monstrosities like SOAP. VS makes it relatively easy to build SOAP bindings to your existing classes, so it's not a painful solution for you.
SOAP is a very painful solution for PHP.
Effectively there is a PHP page that needs to pass certain values to a .NET web service
It sounds like you have an existing web service set up then, correct?
You could try and use the built in SOAP client, but it's an undebuggable and unconfigurable binary blob of horrors that will make you want to kill someone if it doesn't work for you immediately.
Edit: The section below was written incorrectly assuming that both sides were under your control. As this is not the case, you can disregard the rest of the answer. I'm leaving it up because it may be valuable to others.
I would advise a different approach. Set up an endpoint (URL) in your .NET application that expects the data you've specified as POST values, and have PHP POST the data. This has the distinct advantage of being incredibly simple. Because you're new to PHP, simple is a big win.
(In other words, ditch the "web service" -- or make a parallel copy if other things consume that service already.)
PHP comes with a service called PEAR, a repository of helpful classes. You can use HTTP_Request2 to quickly build the HTTP POST request. Chances are that it's already installed. If it isn't, it's easy to install either at the system level using the pear command, or locally in your project.
Here's some quick example code copied straight out of the reference guide:
$request = new HTTP_Request2('http://www.example.com/your/endpoint/url.foo');
$request->setMethod(HTTP_Request2::METHOD_POST)
->addPostParameter('name', '...')
->addPostParameter('email', '...')
->addPostParameter('mobile', '...');
$response = $request->send();
You can then read the response as needed.
Now, this isn't a perfect solution. Your C# code mentions a username and password, which I suppose could be included in the POST data. You could also use HTTP authentication (supported by HTTP_Request2) instead.
Ok, now from what I understand, C# will make a request to the php page, wich then (in simple html) gives it back some data.
PHP Is made to do some calculation serverside and when it's done it will send the prints and echo's to the client side as html (simple explanation)
If you want to start using php you would be best off getting into the basics by following the tutorials at W3School (http://w3schools.com/php/default.asp)
Then you can use http://php.net as a reference for more functions you might need.
The way you'll want to set it up is for C# to make a request to a page like action.php
And then using a $_GET method to get the data so C# would send a request to
action.php?userid='456'

Integrating a JavaScript chat in a php web based game

Is it possible to implement a JavaScript plugin/app in a web text based game? if it is, how is this done. I don't really need the codes. All I want is the functionality. Basically, I want a player in the game to talk to another player in the same game. Like if he(player) enters a room, I want him to see a player and communicate with him or her. Remember, it is chatting with another player, not another user.
Also, I want the php code used to integrate this app onto the site.
WebSockets are part of HTML5 and fit in my webbased game just neatly. There is a full guide on http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/
you can use long polling with js/jquery ajax calls to the php scripts and the database (or files) to make a chat like program
Try searching for some open/free libraries that you can integrate with your game if you don't want to spend time implementing the chat part yourself. I just found this - https://blueimp.net/ajax/ but I have not used it, so you may want to take a look at the features and if it works for you.

Audio-to-Text API?

Are there any (free) speech-to-text API's that I could use with PHP? (I only know PHP and html/css.)
I'd like to send it an audio file, then have it return the transcription.
I haven't found any free APIs but there are a few relatively inexpensive ones:
Quicktate
PhoneTag
Twilio
The first two let you supply an MP3, whereas Twilio (which has the best rates) gets input through their own system, so your choice will depend on your application.
(You'll have to Google PhoneTag and Twilio; I can't post more than one link at my current reputation.)
Voice recognition is computationally rather expensive - it's defnitely not the kind of project you'd implement using PHP - OTOH you might create a web-based interface or integrate in a web / IVR type application using PHP as the glue (the voice search on Android is very cool).
So although there are some off-the-shelf toolkits available, you're probably going to be writing a lot of C code to do anything interesting with them. And how you get on depends a lot on the OS you are using (not stated - example link the first hit from Google).
Dynaspeak from SRI could work.

Real time activity feed - code / platform implementation?

I am defining out specs for a live activity feed on my website. I have the backend of the data model done but the open area is the actual code development where my development team is lost on the best way to make the feeds work. Is this purely done by writing custom code or do we need to use existing frameworks to make the feeds work in real time? Some suggestions thrown to me were to use reverse AJAX for this. Some one mentioned having the client poll the server every x seconds but i dont like this because it is unwanted server traffic if there are no updates. I was also mentioned a push engine like light streamer to push from server to browser.
So in the end: What is the way to go? Is it code related, purely pushing SQL quires, using frameworks, using platforms, etc.
My platform is written in PHP codeignitor and DB is MySQL.
The activity stream will have lots of activities. There are 42 components on the social networking I am developing, each component has approx 30ish unique activities that can be streamed.
Check out http://www.stream-hub.com/
I have been using superfeedr.com with Rails and I can tell you it works really well. Here are a few facts about it:
Pros
Julien, the lead developer is very helpful when you encounter a problem.
Immediate push of new feed entries which support PubSubHubHub.
JSon response which is perfect for parsing whoever you'd like.
Retrieve API in case the update callback fails and you need to retrieve the latest entries for a given feed.
Cons
Documentation is not up to the standards I would like, so you'll likely end up searching the web to find obscure implementation details.
You can't control how often superfeedr fetches each feed, they user a secret algorithm to determine that.
The web interface allows you to manage your feeds but becomes difficult to use when you subscribe to a loot of them
Subscription verification mechanism works synchronous so you need to make sure the object URL is ready for the superfeedr callback to hit it (they do provide an async option which does not seem to work well).
Overall I would recommend superfeedr as a good solution for what you need.

Categories