CCIVR - callcom php
CCIVR - callcom php
Hello,
I try to use a callcom, to call a php script to query a text file in which to return my OK or NO. in IE everything works as I expected, but when using callcom does not get the same result. does anyone know why not work? thank you.
Php script
<?php
$phone = $_GET['phone'];
$file = file_get_contents('Phone_test.txt');
if(strpos($file, "$phone") !== false)
{
echo "OK";
}else{
echo "NOK";
}
?>
file (Phone_test.txt)
012345678
098765432
111111111
222222222
Query test with phone=012345678 – result OK Query test with phone=012345677 – result NO CCIVR with $phone=012345678
I try to use a callcom, to call a php script to query a text file in which to return my OK or NO. in IE everything works as I expected, but when using callcom does not get the same result. does anyone know why not work? thank you.
Php script
<?php
$phone = $_GET['phone'];
$file = file_get_contents('Phone_test.txt');
if(strpos($file, "$phone") !== false)
{
echo "OK";
}else{
echo "NOK";
}
?>
file (Phone_test.txt)
012345678
098765432
111111111
222222222
Query test with phone=012345678 – result OK Query test with phone=012345677 – result NO CCIVR with $phone=012345678
You do not have the required permissions to view the files attached to this post.
Re: CCIVR - callcom php
Hi,
From what i can see the php script that you post is not the one that was tested.
On the screen shots the result is OK and NO, but on the script you have OK and NOK.
From what i can see the php script that you post is not the one that was tested.
On the screen shots the result is OK and NO, but on the script you have OK and NOK.
Re: CCIVR - callcom php
Hi,
my mistake, the correct script has echo "NO".
br
my mistake, the correct script has echo "NO".
br
Re: CCIVR - callcom php
Case there is a error on file_get_contents(), your script returns NO.
I propose you to change your script to:
$phone = $_GET['phone'];
$file = file_get_contents('Phone_test.txt');
if ($file == false)
{
echo "OpenErr"
}
else {
if(strpos($file, "$phone") !== false)
{
echo "OK";
}else{
echo "NOK";
}
}
I propose you to change your script to:
$phone = $_GET['phone'];
$file = file_get_contents('Phone_test.txt');
if ($file == false)
{
echo "OpenErr"
}
else {
if(strpos($file, "$phone") !== false)
{
echo "OK";
}else{
echo "NOK";
}
}
Re: CCIVR - callcom php
I tested but I have the same results.
.
I want to mention that I use the same method (PHP) to check whether a server responds to the command "ping" with the script below and I have no problems with it.
$ping_server = exec("ping -n 1 -w 20 192.168.1.11", $output, $retval);
if ($retval != 0) {
echo "NOK";
}
else
{
echo "OK"; }
thank you for your answer.

I want to mention that I use the same method (PHP) to check whether a server responds to the command "ping" with the script below and I have no problems with it.
$ping_server = exec("ping -n 1 -w 20 192.168.1.11", $output, $retval);
if ($retval != 0) {
echo "NOK";
}
else
{
echo "OK"; }
thank you for your answer.
You do not have the required permissions to view the files attached to this post.
Re: CCIVR - callcom php
Can you make the test, but instead of using phone number to search 012345678, using 098765432
Re: CCIVR - callcom php
Hi,
If it works, then it is because of test strpos () != false, and i advise you check the link http://php.net/manual/en/function.strpos.php
If does not work, then I am sorry but as I have no CCIvr, I do not see how I can help you further.
As strpos may return either FALSE (substring absent) or 0 (substring at start of string), strict versus loose equivalency operators must be used very carefully.
To know that a substring is absent, you must use:
=== FALSE
To know that a substring is present (in any position including 0), you can use either of:
!== FALSE (recommended)
> -1 (note: or greater than any negative number)
To know that a substring is at the start of the string, you must use:
=== 0
To know that a substring is in any position other than the start, you can use any of:
> 0 (recommended)
!= 0 (note: but not !== 0 which also equates to FALSE)
!= FALSE (disrecommended as highly confusing)
Regards
If it works, then it is because of test strpos () != false, and i advise you check the link http://php.net/manual/en/function.strpos.php
If does not work, then I am sorry but as I have no CCIvr, I do not see how I can help you further.
As strpos may return either FALSE (substring absent) or 0 (substring at start of string), strict versus loose equivalency operators must be used very carefully.
To know that a substring is absent, you must use:
=== FALSE
To know that a substring is present (in any position including 0), you can use either of:
!== FALSE (recommended)
> -1 (note: or greater than any negative number)
To know that a substring is at the start of the string, you must use:
=== 0
To know that a substring is in any position other than the start, you can use any of:
> 0 (recommended)
!= 0 (note: but not !== 0 which also equates to FALSE)
!= FALSE (disrecommended as highly confusing)
Regards
- cavagnaro
- Alcatel Unleashed Certified Guru
- Posts: 7013
- Joined: 14 Sep 2005 19:45
- Location: Brasil, Porto Alegre
- Contact:
Re: CCIVR - callcom php
Maybe in the return try to get also the function value
Enviado de meu E6633 usando Tapatalk
Enviado de meu E6633 usando Tapatalk
Ignorance is not the problem, the problem is the one who doesn't want to learn
OTUC/ICS ACFE/ACSE R3.0/4.0/5.0/6.0
Certified Genesys CIV 8.5
Certified Genesys Troubleshooting 8.5
Certified Genesys BEP 8.x
Genesys Developer
OTUC/ICS ACFE/ACSE R3.0/4.0/5.0/6.0
Certified Genesys CIV 8.5
Certified Genesys Troubleshooting 8.5
Certified Genesys BEP 8.x
Genesys Developer
Re: CCIVR - callcom php
Hi Cavagnaro,
Although it should be done (programming good practice), if you check my second post, it has been done and the test result shows that that is not the cause of the problem.
Although it should be done (programming good practice), if you check my second post, it has been done and the test result shows that that is not the cause of the problem.
- cavagnaro
- Alcatel Unleashed Certified Guru
- Posts: 7013
- Joined: 14 Sep 2005 19:45
- Location: Brasil, Porto Alegre
- Contact:
Re: CCIVR - callcom php
What I mean is add the function itself in the output, something like echo "No". strpos($1, $2)
Enviado de meu E6633 usando Tapatalk
Enviado de meu E6633 usando Tapatalk
Ignorance is not the problem, the problem is the one who doesn't want to learn
OTUC/ICS ACFE/ACSE R3.0/4.0/5.0/6.0
Certified Genesys CIV 8.5
Certified Genesys Troubleshooting 8.5
Certified Genesys BEP 8.x
Genesys Developer
OTUC/ICS ACFE/ACSE R3.0/4.0/5.0/6.0
Certified Genesys CIV 8.5
Certified Genesys Troubleshooting 8.5
Certified Genesys BEP 8.x
Genesys Developer