Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP-FX problem with Filemaker (because of URLENCODING DB Parameters)

Featured Replies

  • Newbies

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,

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

  • Author
  • Newbies

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..

Develish,

OK, you say all your characters are becoming encoded.

Have you tried using urldecode around your params?

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.