Querying superfecta

(Is this the right place to ask such a question?)

I have a phone number in $from

How do I query superfecta for the cnam information?

I tried

$curl = curl_init();
$maintpw = “xxxxx”;
curl_setopt ($curl, CURLOPT_URL, “http://maint:${maintpw}@localhost/admin/modules/superfecta/bin/callerid.php?thenumber=$from”);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);

and also

curl_setopt ($curl, CURLOPT_URL, “localhost/admin/modules/superfecta/bin/callerid.php?thenumber=$from”);

$result is always empty.

This was all I could find searching the internet.

Anything in the modules folder is specifically denied from the webserver for security reasons.

Should that be “specifically no longer allowed” since I’m pretty sure it wasn’t as tight a rule once upon a dinosaur’s age?

It’s been a rule for a very long time. 3 years.

Ah, kids these days. LOL.

Three years is not a long time. :slight_smile:

So, is there any way to get a cnam from superfecta from my addon?

My bad 5 years

Superfecta is not written in a way that would allow it to do what you want. This may work however,

<?php

include '/etc/freepbx.conf';
$data = array(
    "callerid" => 555555
);
FreePBX::Superfecta()->setAgi("w");
FreePBX::Superfecta()->execute('ALL',$data);

Thank you everybody! Great help!

Andrew, where would I find the result?

(I was searching for code where this is used, but I could not find any.)

Does anybody know where to find the result returned from superfecta or can tell me where to find a piece of code that I can look at?

It’s returned from execute.

unfortunately this gives no result. (empty on debug.)
Any idea?
Is there a piece of code that uses Superfecta that I could look at?

Thank you for you help! I really appreciate it!

Execute returns data. Did you do anything with it or just run it and expect it to output. Add echo to the front of it.

My code:
dbug($from);
include ‘/etc/freepbx.conf’;
$data = array(
“callerid” => 5555555555
);
$retu = FreePBX::Superfecta()->setAgi(“w”);
dbug($retu);
$retu = FreePBX::Superfecta()->execute(‘ALL’,$data);
dbug($retu);

Freepbx_dbug:

2017-Jan-08 14:17:44 /var/lib/asterisk/agi-bin/sms2email.php:47

1727xxxxxxx

2017-Jan-08 14:17:44 /var/lib/asterisk/agi-bin/sms2email.php:53

2017-Jan-08 14:17:45 /var/lib/asterisk/agi-bin/sms2email.php:55

(replaced numbers with xxxxxx)

I am aware that I am not querying $from but 5555555555, but that was for testing only.

I expected some kind of result …