Opt1kal Posted October 4, 2010 Posted October 4, 2010 Hmm, wondering if anyone can tell me why this code is not updating the database at all. <?php require('includes/functions/database.php'); require('includes/configure.php'); $tfile = 'tracking.xml'; $tmp_file = 'orderid.tmp'; tep_db_connect() or die('Unable to connect to database!'); $query = "select papes_id, orders_id from orders where papes_tracking is null"; $ptrack = tep_db_query($query); $order = tep_db_fetch_array($ptrack); $ft = fopen($tmp_file, "w"); fwrite($ft, $order['papes_id']); fclose($ft); $url_to_file = 'https://www.papesinc.com/pls/papes/ext?data=<?xml+version="1.0"+encoding="utf-8"+?>+<orderquery><ctid>BD5DE1625F694EA4A892C860ADD2B1F5</ctid><orderid>'.urlencode($order['papes_id']).'</orderid>+</orderquery>'; $ch = curl_init($url_to_file); $fp = fopen($tfile, "w"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $oDOM = new DOMDocument(); $oDOM->loadXML(file_get_contents($tfile)); $porder = $oDOM->getElementsByTagName('orderquery'); $ptrack = $porder->item(4)->nodeValue; $pstatus = $porder->item(1)->nodeValue; $tsql = 'Update orders set papes_tracking = ' . $ptrack . ' where papes_id = '.$order['papes_id']; $psql = 'Update orders set papes_status = ' . $pstatus . ' where papes_id = ' . $order['papes_id']; mysql_query($tsql); mysql_query($psql); tep_db_close(); ?> This would be the xml file it loads, but this is for a pending order hence the line where it updates a tracking number is for a completed order: <?xml version="1.0" encoding="utf-8" ?> <orderquery> <orderid>83543</orderid> <status>Pending</status> </orderquery> And this is what a completed order should look like <?xml version="1.0" encoding="utf-8" ?> <orderquery><orderid>555555555</ord erid><status>Complete</status> <!-- the actual total you will be charged by Pape's (minus shipping) --> <invtotal>99999.99</invtotal> <!-- the carrier; this will be either FEDEX or UPS --> <shipcarrier>UPS</shipcarrier> <!-- the tracking number --> <trackingnum>XYZ983984872897</trackingnum></o rderquery> I would love to use an if statement but for some reason that was not working either. I'm at a loss as whats going on with this. Thank you for any help offered.
Opt1kal Posted October 6, 2010 Author Posted October 6, 2010 Hmm, no one has any idea as to whats going on here? Well, thanks for the lack of help....
MrPhil Posted October 6, 2010 Posted October 6, 2010 Well, thanks for the lack of help.... Well, screw you too, buddy! Everyone here is volunteering their time to help, and you had a rather complex problem. With an attitude like that, you'll be lucky to ever get any help.
Opt1kal Posted October 6, 2010 Author Posted October 6, 2010 And I understand that, I'm just a little upset that no one ever responded, I mean not even a "Wow, yeah I don't know...wish I could help, if you find the answer let me know." I mean nothing... Thats what got to me... I do apologize if it came off as a little harsh.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.