CCIVR - callcom php

User avatar
letacla
Member
Posts: 33
Joined: 28 Dec 2009 04:38
Location: Romania

CCIVR - callcom php

Post by letacla »

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
Capture0.JPG
Query test with phone=012345677 – result NO
Capture01.JPG
CCIVR with $phone=012345678
Capture1.JPG
You do not have the required permissions to view the files attached to this post.
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 696
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: CCIVR - callcom php

Post by sadim »

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.
User avatar
letacla
Member
Posts: 33
Joined: 28 Dec 2009 04:38
Location: Romania

Re: CCIVR - callcom php

Post by letacla »

Hi,
my mistake, the correct script has echo "NO".

br
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 696
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: CCIVR - callcom php

Post by sadim »

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";
}
}
User avatar
letacla
Member
Posts: 33
Joined: 28 Dec 2009 04:38
Location: Romania

Re: CCIVR - callcom php

Post by letacla »

I tested but I have the same results. :(
Capture2.jpg
.

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.
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 696
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: CCIVR - callcom php

Post by sadim »

Can you make the test, but instead of using phone number to search 012345678, using 098765432
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 696
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: CCIVR - callcom php

Post by sadim »

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
User avatar
cavagnaro
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 7013
Joined: 14 Sep 2005 19:45
Location: Brasil, Porto Alegre
Contact:

Re: CCIVR - callcom php

Post by cavagnaro »

Maybe in the return try to get also the function value

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
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 696
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: CCIVR - callcom php

Post by sadim »

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.
User avatar
cavagnaro
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 7013
Joined: 14 Sep 2005 19:45
Location: Brasil, Porto Alegre
Contact:

Re: CCIVR - callcom php

Post by cavagnaro »

What I mean is add the function itself in the output, something like echo "No". strpos($1, $2)

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
Post Reply

Return to “CCD / CCS / CCIVR”