PDA

View Full Version : Php Api


Screwloose83
February 14th, 2017, 05:17 AM
HI Guys

I'm looking at making our phone system talk to PHP but i can not find a way to look up a contact via the PHP API. Can you point me in the right direction?

Also is there a way to POP a CommitCRM screen application via the API? Or if not is there a way to open a chrome window with the account already open via a URL?

Support Team
February 14th, 2017, 06:06 AM
Thank you for asking. If I get this correctly you are looking for a way to have an incoming call look for a contact in your RangerMSP's database and the pop a message with the contact details. This can be implemented, though you probably won't be using PHP for that but rather C#, C++ or VB.NET and use the API. Using the API you can query the Accounts and Contacts database and get the entire record details, and then your custom program can simply pop a message with the details, also - your program will be able to open a URL that will take the user directly the Contact/Account details page as displayed in the Web portal. Please ping us once you get to this phase and we'll provide you with the relevant details on how to construct the URL. Hope this helps.

Screwloose83
February 14th, 2017, 09:26 AM
Thanks Going to be using vb.net

Screwloose83
February 14th, 2017, 09:30 AM
I was looking for a way to look up names form phone numbers from PHP so i could get the CDR records in the freeswitch system to work correctly. I can get it to query a mysql database but at commit dont have a connector for centos to its DB i need to use the PHP API. Do you know if this can be done. A simple http://commitip:8888/search.php?number=555555555 returns Bill?

Support Team
February 14th, 2017, 10:35 AM
That's doable. You'll need to write a small program that listens on any port you choose, it will then parse the URL, get the phone number and will look it up. Hope this helps.

lpopejoy
February 14th, 2017, 04:32 PM
Just use odbc drivers. Works perfectly for what you are describing. Though you may need to use IIS and Windows

Screwloose83
February 16th, 2017, 03:48 PM
What odbc connector did you use? Are you interested in sharing your code you used for the look ups?

Thanks

lpopejoy
February 16th, 2017, 05:14 PM
Info on ODBC: here

Note, I think you need CommitCRM SQL version to use this.

Setup the ODBC connections as a system DSN on a windows box.

Then in IIS / Apache on that same windows box, in PHP use something like this, for example:

$conn=odbc_connect('CommitCRM','','');

//get a listing of companies that match phone # - btw, I didn't test this query. :)
//note that you may want to sanitize the phone # field - like what if there are - or ( or )'s?
$sql="select fullname, recid from cards where phonenumber like '%some cleaned up string%' order by fullname desc";
$rs=odbc_exec($conn,$sql);
while (odbc_fetch_row($rs)){
$employeenamesAr[odbc_result($rs,2)]=trim(odbc_result($rs,1));
}

Screwloose83
July 16th, 2017, 07:29 AM
Thanks. I got it working. Just a few notes for others. Need to use 32bit ODBC. And i had to change some of the Field Names. But its a start. Thanks
<?php
$conn=odbc_connect('CommitCRM','','');
if ($conn) {
//echo "Connection established.";
} else{
die("Connection could not be established.");
}

//get a listing of companies that match phone # - btw, I didn't test this query. :)
//note that you may want to sanitize the phone # field - like what if there are - or ( or )'s?
$sql="select FULLNAME , recid from cards where PHONE1 like '%some cleaned up string%' order by FULLNAME desc";
$rs=odbc_exec($conn,$sql);
while (odbc_fetch_row($rs)){
echo $employeenamesAr[odbc_result($rs,2)]=trim(odbc_result($rs,1));
}