Call into a website and use php to recognize caller ID - php

I have this idea where I want to allow someone to call a phone number from their cell phone, and then a website would display their caller ID. I want to do this in php, but I'm really not sure how. I'm pretty good with PHP and I'm assuming you need some kind of GSM modem attached to the web server to accept the incoming phone calls, but that's really as far as I can get. If anyone can point me in the right direction that would be great.

There are a couple of services that launched recently which allow you to accept phone calls using an API:
http://cloudvox.com/
http://www.twilio.com/
These are probably easier than trying to physically receive the phone calls yourself.
If you went for using a modem then you'd obviously need drivers for it and to program against whatever API those drivers exposed.
Either way, you're going to need a way to link the phone call to the session on the website - maybe generating a unique number for each visitor, or by getting them to input a sequence of digits when they call. The workflow would then look something like
User visits website
Website generates session ID, provides user phone number
User rings number
Call-handling software/script/etc executed by cloudvox/twilio API or modem drivers
Call is mapped to a session (by inputted number, phone number, etc)
Caller ID is associated with website session
User refreshes website or website auto-refreshes
Website displays Caller ID to user

Related

Quickbooks PHP API Generating Invoices On Order Submission

I have a client that wants to take orders via an online form, with the idea being that an order can be submitted and stored in a database via my application while simultaneously generating an invoice on submission in QuickBooks.
How do I do this in PHP when the person entering in the order is not the client but a client of the client? It seems like Quickbooks uses Oauth tokens and a javascript library to generate them to connect a company to an app, but I'm simply writing a backend for one company and want that backend to create invoices when saving an order. How do I think about this?
I'm not interested in anyone having to hit a button that says "connect to quickbooks" especially not the person filling the order because again, that person is a customer and doesn't need to know about the internals of the customer's invoicing system.
I just really want to use the Accounting API to generate invoices. Is there no way to simply link my backend to my one company directly in the Quickbooks SDK configuration and achieve this, or do they need to use a javascript library to get tokens. I'm unclear about what direction I should be going in and don't want to waste time with a client-side library if I don't need it to do backend logic.
Here's some example code that does exactly what you're looking for:
https://github.com/consolibyte/quickbooks-php
Along with a quick-start guide:
http://www.consolibyte.com/docs/index.php/PHP_DevKit_for_QuickBooks_-_Intuit_Partner_Platform_Quick-Start
Also see notes about your comments below -- you're on the right track, you're just misunderstanding how OAuth works:
It seems like Quickbooks uses Oauth tokens and a javascript library to generate them to connect a company to an app, but I'm simply writing a backend for one company and want that backend to create invoices when saving an order.
Correct, Intuit uses OAuth, and a little Javascript thing to kick off the OAuth process.
I'm not interested in anyone having to hit a button that says "connect to quickbooks"
Someone needs to hit this button... BUT only ONE PERSON needs to hit the button ONCE, EVER, and then NEVER again.
The owner of the company (e.g. your boss) needs to click the button ONCE, which gives the OAuth creds (and the realm ID) to you. Once your boss has done this ONCE, then you have the creds to use forever, for all of the actual customers.
Your customers (e.g. the people actually checking out/placing orders) DO NOT click any buttons, nor do they see or have any idea at all that you're even using QuickBooks.
just really want to use the Accounting API to generate invoices.
Cool, you can totally do that!
Is there no way to simply link my backend to my one company directly in > the Quickbooks SDK configuration and achieve this, or do they need to use a javascript library to get tokens.
Follow the quick-start above. It should take you about 15 minutes to get a working OAuth connection, and then you never need to use the client-side stuff ever again.
You only need to authenticate every 180 days btw.
If you use the reconnect script, you only need to authenticate ONCE, and can automatically renew the tokens every 180 days, no user-interaction required.
https://github.com/consolibyte/quickbooks-php/blob/master/docs/partner_platform/example_app_ipp_v3/reconnect.php
Well with the realm_id for example, I don't understand how that relates to ouath.
The realm ID is just a unique identifier for the particular QuickBooks Online company you're trying to connect to. Yes, you need to store it. If you use our libs, this is done for you automatically.
I guess I don't understand if I'm developing for one client why can't I just get their realm_id from them and then keep using it rather than making them do some form of authentication?
Again, they only have to authenticate ONCE. That's Intuit's way of giving you the realm ID and credentials you need to connect. Once you've done it ONCE, you never need to do it again. It takes all of about 30 seconds.
If they were to just give you OAuth creds without any authentication, it would be a gigantic security hole. If you read the Wikipedia article on OAuth it talks in depth about this, and the goals of OAuth.
Okay I think I get it, so they have to authenticate once every 180 days?
Once every 180 days, UNLESS you use a reconnect script, in which case they just authenticate once and then never ever have to worry about it again.
So I can store the token and the realm_id in a database before it expires and just use that?
Yes.
In this way my client can authenticate and then my scripts can generate invoices for them when their customers visit our website?
Yes!

How should i handle a product signup through an iPhone app?

I have an iOS app which reads out a serial number from a hardware through bluetooth or wifi. I also have a website where users can register to see which product they own. (the problem is a little more complex, i just wanted to simplify things).
When they start using the iOS app, it will ask if they want to register the product on my website. In this case, the iPhone app redirects the user to my signup(or login) page and the serial number is simply a get parameter in my url(for example: www.samplesite.com?signup?sn=0100013) and of course the sn value will be stored in the database.
Is there a way to hide this value from the url, or make things safer, so people can't register random serial numbers through the system? My main issue is that the serial number is not unique, it just simply starts from 0 and increased one by one.
Encrypting the SN with a fixed key which stored on my website and inside the app is a solution?
"Encrypting the SN with a fixed key which stored on my website and inside the app is a solution?"
This could be a possible solution.
Here is another solution:
Make sure that every user has a unique API_KEY so that you can track
users of your iPhone application.
While making the request to your
web server(like a web service call), make sure that the page has
this API_KEY www.samplesite.com?signup?sn=0100013&api_key=abc123.
Based on the API_KEY, make decisions on your web server either to
store or discard or do whatever with this call.

Couting IP unique visitors and sending it to mysql database

I'd like to know how can i get information about uniques IP's to my site specify link and store that information in mysql database to particular user.
I need that script count not only http://example.com.com but also ex.: http://example.com/somesub/this/link.
Because i want to develop project in which users get traffic to my system and they get paid.
(Pay to Promote system).
How can i develop this? Any ideas about php code?
First of all use $_SERVER['REMOTE_ADDR'] to find the request IP Address or see How to get client IP address PHP.
then at the start of each page of your site you should get this value (which acts like a primary key) and do query to the database to increase the specific counter.
P.S: you will find problems in case the client is using proxy to get to your site, see the link above for more information.

Calling my website from my phone

Is there any way to call my website to receive some data about it?
For example: I connect my phone to my PC and call it from another cell phone and then i press 1 and it will tell me how many users online or something like that?
The short answer is no, the long one is yes this is possible but for this functionality you would need a VERY expensive call system to be installed that interfaced with your site.

Is there any way to get the number of FB users on a specific country?

I would like to know if is there any possible way to show the total number of users of a specific country in my webpage. As far as I found, you can not get it through API.
I'm guessing you really want the total number of users on facebook who have 'liked' or used facebooks oauth to connected with your site.
Do you use graph api in your site? I'm pretty sure you can query by country name--as long as the user's who have shared that info with you have provided it.
Check this out... http://developers.facebook.com/docs/reference/api/
And this: http://developers.facebook.com/docs/reference/api/insights/
From their site
Facebook Insights provides the ability to see geographic and
demographic data for people that have Liked a Page or installed an
app. Location data is based on the geographic location of each person
as determined by their browser IP address and is limited to the top 20
countries and cities. All other demographic information is aggregated
and non-personally identifiable.
Generic searches can be done like this:
https://graph.facebook.com/search?type=location&place=166793820034304
Where the place id is the id for whatever you want to search on.
https://graph.facebook.com/search?type=location&place=166793820034304
Disclamer: This method is not supported by Facebook. Use it at your own risk. I take no responsibility whatsoever.
Go to: https://www.facebook.com/ads/manage/adscreator/
Fill in the ad info with something random (eg. google.com as the url)
In the next part you'll notice a dynamic reach estimation that changes depending on the parameters you select, including country. Try changing the country and observe the network activity with for instance the developers tools of Google Chrome.
Call the ajax url that returns the json data with the proper parameters programatically, this should be easy to figure out in the previous step.
Collect and store the json data for your evil deeds.
???
PROFIT!
The actual ajax call and parameters change from time to time, which is why I didn't include them directly, but it should be easy enough to figure it all out. Also note that they are estimates, even if they come from Facebook, they don't count every single user every time an advertiser sets up an ad — it's the best estimate you can possibly get though.
This method as I mentioned is neither official nor supported by Facebook, but sites like socialbakers.com or checkfacebook.com have been using them for ages. (There, I revealed the secret)

Categories