Skip to main content
Inspiring
May 12, 2009
Question

HTTP get

  • May 12, 2009
  • 1 reply
  • 588 views

At my workplace we have a trixbox phone system which has a module installed called CallerID lookup sources. We also have our CRM system which I

wrote in coldfusion.

The callerid module lets you set a lookup source as a webpage sending the telephone number using the GET method as shown below:

http://cfserver/cidlookup.cfm?cid=[number]

What I need to do is fill cidlookup.cfm with code that looks up the telephone no. in our database and then returns it, i believe on the Request-URI header?

I've plenty of CF experience but never really used the HTTP GET command (normally just use POST).

Can someone point me in the right direction as there is little or no documentation on this on internet searches/forums etc.

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
May 17, 2009

The page could just get the (one) telephone number from the database and display it. Something like

<cfparam default="0" name="url.cid" type="integer">

<cfquery datasource="myDSN" name="getTelNo">
     select telephoneNumber
     from customer
     where callerID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.cid#">
</cfquery>

<cfif url.cid eq 0 or getTelNo.recordCount eq 0>
Bad caller ID.
<cfelse>
Telephone number: <cfoutput>#getTelNo.telephoneNumber#</cfoutput>
</cfif>

Participating Frequently
May 17, 2009

Just to add to BKBK's reply. I would not allow the zero url.cid thru my cfquery. You can then use boolean to check the recordcoun. e.g.

<cfif getTelNo.recordCount>

ok

<cfelse>

not ok

</cfif>

..assuming the CallerID field is an indexed.