I have recently created a script which should be passed an IP address of the users FM DB Server location, then the script will connect to that server with the given username, password, IP Address and DB Name.
However, no matter what I pass as the IP, it never throws an error.
Is there some form of error handling within the FileMaker PHP API for connection errors?
Thanks in advance!
All the FileMaker API calls return an result object in case of error. You should try this:
Here is an example:
$fm = new FileMaker();
// Set 'hostspec' property using setProperty()
$fm->setProperty('database', $fmConfig['db']);
$fm->setProperty('hostspec', $fmConfig['host']);
$fm->setProperty('username', $fmConfig['user']);
$fm->setProperty('password', $fmConfig['pass']);
$dt = date('m/d/Y H:i:s', $myDate);
$freq = $fm->newFindCommand("myTestLayout_1.0") ;
$freq->addFindCriterion("ModificationTimeStamp", ">".$dt);
$result = $freq->execute();
if (FileMaker::isError($result)) {
$ErrMsg = 'Error code: '.$result->getCode().' Message: '.$result->getMessage();
throw new Exception ($ErrMsg);
}
$foundRecords = $result->getRecords();
echo count($foundRecords)." records";
The server that you're making the calls from needs to have curl support - make sure that's enabled. Best bet is to try locally against your FMS box with the test database - once you've got that working then you can try the remote connection.
Related
I am using laravel package(furqansiddiqui/erc20-php) for erc20 token transfer, But i am getting error when execute the code
$geth = new EthereumRPC('127.0.0.1', 8545);
$erc20 = new ERC20($geth);
$token = $erc20->token("0x05f4a42e251f2d52b8ed15e9fedaacfcef1fad27");
var_dump($token->name()); // string(7) "Zilliqa"
Make sure to run geth by --rpc parameter
geth --rpc
As easier way to connect to Ethereum network, you can use https://infura.io
Infura support mainnet and testnets (rinkeby, ropsten, kovan, goerli), thats good for development.
I can't log in my app using vtwsclib library function doLogin().
I would like retrieve some data from crm via the web services but I keep getting "login failed" message.
Beside that, I got no errors or warning from php.
My system is a xampp localhost, php -v 7.1.33.
Do I have to make some changes within the library code in addition of the code here below?
$url = 'urlofmyvtecrmaccess';the url to my crm access page.
$client = new Vtiger_WSClient($url);
$login = $client->doLogin('mycrmuser', 'mywebserviceaccesskey');
if (!$login)
echo 'Login Failed';
else
echo 'Login Successful';
Did you provide full url to the webservice file ?
Like http://yourcrm.com/webservice.php
You could find if there is any error in the api call using
$client->lastError() method
You can also debug inside doLogin() method to identifiy the error
Check the api response if it has any information of error
You must have to pass your encrypted password and for encryption, you have to use md5.
$encryptedPassword = md5('useraccesskey');
$login = $client->doLogin('mycrmuser', $encryptedPassword);
I am trying to connect to LDAP server using below Coldfusion code. But I get an error "Authentication failed:[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903C9, comment: AcceptSecurityContext error, data 52e, v23f0 ]"
<cfldap
action = "Query"
server = "xxxx.edu"
attributes = "*"
name = "result"
password = "yyy"
port = "000"
start = "cn=xxx,ou=xxx,dc=xx,dc=xx,dc=edu"
username = "xxx">
Are the parameters used in the above cfldap tag are correct or do I need to add any other parameters? Does this issue relate to SSL certificate? Any idea what should I use in "start"?
I have successfully connected to LDAP using php using the same parameter values
but the same values when used are throwing an error in Coldfusion? Please suggest.
Thanks in Advance
I am trying to obtain client's time zone for one of my projects using PHP. Saw a post in stackoverflow with solutions for what I was looking for. Here's the link to that post.
get user timezone
I followed the most upvoted solution but it produced an error something like this.
Suppose $_SERVER['REMOTE_ADDR'] returns 212.88.207.202 to $ip, I hardcoded that value to $ip in my develpoment phase.
It doesn't matter since hardcoding 212.88.207.202 or using $_SERVER['REMOTE_ADDR'] this returns the same value to $ip.
But when I run the page, I get this error.
Warning: file_get_contents(http://smart-ip.net/geoip-json/212.88.207.202): failed to open stream: No connection could be made because the target machine actively refused it.
Here's the code
<?php
$ip = '212.88.207.202'; // means we got user's IP address
$json = file_get_contents( 'http://smart-ip.net/geoip-json/' . $ip); // this one service we gonna use to obtain timezone by IP
// maybe it's good to add some checks (if/else you've got an answer and if json could be decoded, etc.)
$ipData = json_decode($json, true);
//var_dump($ipData);
if ($ipData['timezone']) {
$tz = new DateTimeZone( $ipData['timezone']);
$now = new DateTime( 'now', $tz); // DateTime object corellated to user's timezone
} else {
// we can't determine a timezone - do something else...
}
?>
Where did I go wrong???
Well.....the problem is with the target machine. I tried opening smart-ip.net in my browser, but I wasn't able to do so. I think they are no longer running their service. That is the reason why target machine actively refused my connection. Viola!
I have the following PHP code, which up to a week or so ago was working to send Twitter direct messages to a particular user. I now get "HTTP_OAuth_Exception: Unable to connect to tcp://api.twitter.com:80. Error #0: php_network_getaddresses: getaddrinfo failed: Name of service not known in /usr/share/pear/HTTP/OAuth/Consumer.php on line 257"
I've searched around and can't find that anything has changed with Twitter since it was working and the server configuration also hasn't changed. I tried using SSL in case Twitter suddenly required connection via SSL, but that gave basically the same error (except it said ssl and port 443).
I'm at a loss to see what's wrong and don't believe anything changed on my side. My code is based on the example in the Services_Twitter documentation (http://pear.php.net/package/Services_Twitter/docs/latest/Services_Twitter/Services_Twitter.html#var$oauth)
Any help would be greatly appreciated.
require_once 'Services/Twitter.php';
require_once 'HTTP/OAuth/Consumer.php';
$twitterto = 'xxxxxxxxxxxx';
$message='This is a test message';
$cons_key='xxxxxxxxxxxx';
$cons_sec='xxxxxxxxxxxx';
$auth_tok='xxxxxxxxxxxx';
$tok_sec='xxxxxxxxxxxx';
try {
$twitter = new Services_Twitter();
$oauth = new HTTP_OAuth_Consumer($cons_key,
$cons_sec,
$auth_tok,
$tok_sec);
$twitter->setOAuth($oauth);
// The error is raised on the following line.
$twitter->direct_messages->new($twitterto, $message);
$twitter->account->end_session();
} catch (Services_Twitter_Exception $e) {
echo $e->getMessage();
}