snowdog Posted July 4, 2006 Share Posted July 4, 2006 We can run this code from a browser and it works fine. Once we try and run it from a cron, it exits the script on this line. $xml_parser = xml_parser_create();Have written a log file before and after the area and have determined this is where it is crashing. The coding is sending information out to an external server and getting information back. If I execute the code from the browser no problems but not from the cron. Any ideas??Here is some of the code belowThanks Snowdog// do the curl stuff $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 30s curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost); // add POST fields $curl_result = curl_exec($ch); // run the whole process if (curl_errno($ch)) { $error_message = curl_error($ch)." on client_id $row_billing->client_id\r\n"; fwrite($handle,$error_message); $email_error_message .= $error_message; } else { curl_close($ch); } // parse the xml return $xml_parser = xml_parser_create(); [color=red]//****** THIS IS WEHRE IT IS CRASHING ******//[/color] xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,0); xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE,1); xml_parse_into_struct($xml_parser, $curl_result, $vals, $index); xml_parser_free($xml_parser); // get some of the vars from the parsed xml Array $status = $vals['4']['value']; $start = substr($vals['1']['value'],0,19); $end = substr($vals['1']['value'],23,5); Quote Link to comment https://forums.phpfreaks.com/topic/13658-xml_parser_create-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.