Jump to content


xml_parser_create problem

  • Please log in to reply
No replies to this topic

#1 snowdog

  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 04 July 2006 - 05:23 PM

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 below

Thanks 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";
                    $email_error_message .= $error_message;

                  // parse the xml return
                  $xml_parser = xml_parser_create(); //****** THIS IS WEHRE IT IS CRASHING ******//
                  xml_parse_into_struct($xml_parser, $curl_result, $vals, $index);

                  // 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);

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users