dfowler Posted May 18, 2010 Share Posted May 18, 2010 Hey guys, I'm having the most annoying time with a script I wrote. I am sending an XML call and then attempting to parse the results. In getting one of the variables I am using this: if(isset($response->CreateAccountResponse->Account->attributes()->ClientID)) { $ClientID = (string)$response->CreateAccountResponse->Account->attributes()->ClientID; } else { if (isset($response->CreateAccountResponse->Result->attributes()->ErrorCode)) { $error = (string)$response->CreateAccountResponse->Result->attributes()->ErrorCode; header("Location: error.php?id=".$error); } } This works 90% of the time. However, if there is an error during the process, I am getting this: Warning: CreateAccount() [function.createaccount]: Node no longer exists in includes/functions.php on line 405 Warning: Cannot modify header information - headers already sent by (output started at includes/functions.php:405) in account.php on line 265 Line 405 is the first if line (checking to see if the ID isset). Anybody understand why this is happening? Shouldn't it see that it doesn't exist and move to the else seamlessly? I don't understand why it is displaying an error before moving to the else block. I have no control of the error messaging on the server, so I can't turn that off. Thanks for any help! Link to comment https://forums.phpfreaks.com/topic/202178-simplexml-issue/ Share on other sites More sharing options...
Cagecrawler Posted May 18, 2010 Share Posted May 18, 2010 Check line 265 in account.php, something is causing your headers to be sent. Nothing can be output to the screen before all headers are sent. Link to comment https://forums.phpfreaks.com/topic/202178-simplexml-issue/#findComment-1060161 Share on other sites More sharing options...
dfowler Posted May 18, 2010 Author Share Posted May 18, 2010 Check line 265 in account.php, something is causing your headers to be sent. Nothing can be output to the screen before all headers are sent. Oh, I know what solves the headers issue. It's the error message for the node issue. If that error wasn't being displayed the page would redirect with no problem. I'm just confused as to why it is displaying the error message for the 'node does not exist' when I am using an if(isset()). I could be wrong, but to me it seems the code is acting like this (on errors): [*]checks first if statement [*]throws and error because that node doesn't exists [*]because that node isn't set it goes to the else bracket [*]checks if statement for errorcode [*]the error code node isset so it sets the variable and tries to redirect [*]can't redirect because it shot out the error from the first if statement Link to comment https://forums.phpfreaks.com/topic/202178-simplexml-issue/#findComment-1060251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.