Hi,
I have the following code (simplified for easy reading)
$result = $client->call('get_updates', array());
if (!$result) {
echo "error 1";
continue;
}
// here's the problem
if ($result['faultstring'] == "no updates found") {
echo "error 2";
continue;
}
// here's the problem
if ($result['faultcode'] == "Server") {
echo "error 3";
continue;
}
The problem is that when everything is working (ie. no faults), I get:
Notice: Undefined index: faultstring in /home/me/script.php on line 40
Notice: Undefined index: faultcode in /home/me/script.php on line 45
What is the best way to avoid this? I was going to just do something like:
if (isSet($result['faultstring']) {
if ($result['faultstring'] == "no updates found") {
echo "error 2";
continue;
}
}
but it seems a bit messy.
Is there a better method? I'm still new to using faults correctly so
am not sure what the best method is.
Thanks for any style advice with this issue!
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
|