Jump to content

This topic is 6768 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

hi,

I'm using PHP FX to interface with Filemaker and i am having a problem in the way fx.php urlencodes DB paramenters before passing it to the Filemaker server..

This is my php script

<?php

include_once('../fx/fx.php');

include_once('../db_config.php');

[email protected];

$cand=new FX($dbHost,$port,$dbType,$conType);

$cand->setDBPassword($dbPass,$dbUser);

$cand->setDBData($dbName,'webdev_Candidate');

$cand->AddDBParam('email',$email,'eq');

$cand_data=$cand->FMFind();

$count= $cand_data['foundCount'];

unset($cand);

echo $count;

?>

I checked the url that is being called and its as follows:

(i've slightly modified the url by removing slashes from http:// because the forum post is truncating the address )

There is an email record called [email protected] in the database, since i can't use @ in the query i've changed the @ to + using php.

http:xxxx:[email protected]:80/fmi/xml/FMPXMLRESULT.xml?-db=JobPostings&-lay=webdev_Candidate&-max=50&email.op=eq&email=test%2Btest.com&-find

This above query returns zero results since filemaker searches for "test%2Btest.com" and not "test+test.com"

i've also tried to use quotes but even they are gettin urlencoded to %22

by manually calling the url

htp:xxxx:[email protected]:80/fmi/xml/FMPXMLRESULT.xml?-db=JobPostings&-lay=webdev_Candidate&-max=50&email.op=eq&email=test+test.com&-find

it returns the XML page with the resultset correctly

Does anyone have any clues how i can fix this, or override php-fx from urlencoding select parameters..

Is there something wrong in my approach?

Thanks,

Posted

Hi,

The problem with the email address is that the @ symbol when used in a find is a FileMaker wildcard character.

You have two options. You can either;

a. Escape the @ symbol. Change your $email variable to;

$email=str_replace('@','@',$fieldforemail); 





b. Wrap your email field with quotes in the AddDBParam;




$cand->AddDBParam( 'email','"'.$email.'"',"eq"); 

This is basically the same as if you were in FileMaker. So if you have problems with queries try them natively in FileMaker first.

HTH

  • Newbies
Posted

i think you din't get my problem.

i realized that i can't use the symbol '@' so i replaced it with '+' . yes i did try the queries natively in filemaker and they work, but the problem is that when i run the query, php calls the URL its gettin "URLencoded" which means '+' becomes '%2B' and i can't even use quotes even they get encoded.. i tried using slashes to escape.. but it doesn't work.

no matter what i do.. i can't perform a search..

Hope this is clear..

This topic is 6768 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.