Jump to content

tunnelboy

New Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About tunnelboy

  • Rank
    Newbie
  1. Trying to create a very simple API script sending XML data. When I send the "hard coded" XML, it works perfectly. When I add a form to supply the data for the XML, I get a 500 Internal Server error. Have tried it on two different servers. No error in the logs. Stumped. Examples below are VERY simplified (and obviously won't do anything as-is) to show what I'm dealing with. This one works fine: <?php $xml = "<Order><UserId>foo</UserId><Password>foo</Password><Mode>Test</Mode><Name>Charles R. Hodges</Name>"; $xml .= "</Order>"; $url = 'http://sitename.com'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($response); print_r($xml); ?> And then I use this one and all heck breaks loose with the 500 Internal Error: <?php if (isset($_POST['submit'])) { $xml = "<Order><UserId>foo</UserId><Password>foo</Password><Mode>Test</Mode><Name>{$_POST['name']}</Name>"; $xml .= "</Order>"; $url = 'http://sitename.com'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($response); print_r($xml); exit; } ?> <html>... etc <form method="post" action=""> Name: <input type="text" name="name" /> <p><input type="submit" name="submit" "Add to XML string and send" /> </form> ?>
  2. So probably a stupid question, but I have my shared hosting domain called oldcompany.com. I have an add-on domain (not a sub-domain) within this account called newcompany.com which is really the one we use everywhere. For the sake of cookies and sessions, which would be correct? setcookie("foo","test",strtotime('+180 days'),"/","oldcompany.com"); or setcookie("foo","test",strtotime('+180 days'),"/","newcompany.com"); All references on the website are to newcompany.com and there is NO reference whatsoever to oldcompany.com
  3. Hmmm.. I looked in my php.ini settings and session.save_path is /tmp. Maybe changing that to a folder within my root folder?
  4. I have all errors set on and none are being returned. Yes this IS on a shared server, but I'd need to ask whether they are sharing all session data files in /tmp. *If* they were, do you think that would be causing the issue? Should I create my own session id instead?
  5. No of course. Maybe I should have made that: sendToLog; # My function not listed in this code example that logs empty sessions to a log file
  6. Page 1: <?php session_start(); $_SESSION['test'] = "foo"; ?> <a href="page2.php">Click to continue</a> Page 2: <?php session_start(); if (empty($_SESSION['test'])) { sendToLog; } echo "<pre>"; print_r($_SESSION); ?> Pulling my hair out. Nine times out of ten this will show the content of "test". But sometimes it doesn't. I've tried it with every browser and device I have and I can't get it not to work. Windows, Mac, iPhone, Android, Chrome, IE, Firefox, Safari. No rhyme or reason. I had my buddy try on his Windows Chrome browser and it consistently doesn't work. I've had others try it and the log file randomly fills up. Sometimes it does, sometimes it doesn't. No pattern whatsoever. I have contacted my host and they say everything is fine on their end. Any ideas? Stumped.
  7. This may not be the correct place to post this, but here goes. I have a home-made e-commerce (PHP/MySQL) site that has been working fine for years. Well 99.99% of the time. Here's the problem scenario: 1) User checks out in this case with PayPal. 2) User is sent to PayPal to pre-authorize payment. PayPal returns user to our website. 3) User verifies address and ship methods and again is sent to PP for final authorization. 4) PP payment is approved BUT when PP forwards back to our website, our website is down or times out for whatever reason. Payment is recorded at PP, but not at our site because we never got the approval from PP due to the timeout or whatever. It's happened I'd say 10 times in 5 years. Any ideas how to alleviate this problem? Thanks, Sam
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.