njdubois Posted January 29, 2016 Share Posted January 29, 2016 Just recently updated our servers version of php. From 5.3 (or 5.2.3) to 5.6. The code found at this link (I'll include the code below so you don't have to download the file): https://www.bluepay.com/sites/default/files/documentation/BluePay_bpdailyreport2-PHP.zip Use to work, but now we get the error outputted at line 36 : Problem with API Server. Contact systems administrator We are currently waiting to hear from a bluepay developer but it has been hours. As far as I can tell by spending the morning on google is that there is some server setting, maybe in the php.ini file that we do not have set right. We were not responsible for setting up the original code, and that person is not available. Any thoughts? Your time, help and assistance is so much appreciated! Nick <?php /////////////////////////////////////////////////////////////////////////////////////// // Bluepay Daily Report 2 - Return File PHP Sample Code /////////////////////////////////////////////////////////////////////////////////////// $BP_AccountID = "BLUEPAY_ACCOUNT_ID"; $BP_SecretKey = "BLUEPAY_SECRET_KEY"; $BP_MODE = "TEST"; //TEST or LIVE // Start Date/End Date $report_start_date = (isset($argv[1])) ? $argv[1] : ""; $report_end_date = (isset($argv[2])) ? $argv[2] : ""; if ($report_start_date == "") { $report_start_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); } if ($report_end_date == "") { $report_end_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); } // Create post to daily report try { $dailyreport_url = 'https://secure.bluepay.com/interfaces/bpdailyreport2'; $tamper_proof_seal = md5("$BP_SecretKey$BP_AccountID$report_start_date$report_end_date"); $dailyreport_post_data = array('ACCOUNT_ID'=>$BP_AccountID, 'MODE'=>$BP_MODE, 'REPORT_START_DATE'=>$report_start_date, 'REPORT_END_DATE'=>$report_end_date, 'TAMPER_PROOF_SEAL'=>$tamper_proof_seal); $dailyreport_url_params = http_build_query($dailyreport_post_data); // $opts = array('http'=>array('method'=>"POST", 'content'=>$dailyreport_url_params)); $ctx = stream_context_create($opts); $fp = @fopen($dailyreport_url, 'rb', false, $ctx); if (!$fp) { echo "Problem with API Server. Contact systems administrator.\n"; exit; } $response = @stream_get_contents($fp); if ($response === false) { echo "Problem reading data. Contact systems administrator.\n"; exit; } else { $dailyreport_results = $response; } } catch (Exception $e) { echo "ERROR: Site Timeout\n"; exit; } // Write to screen echo "Start Date: $report_start_date\nEnd Date: $report_end_date\n"; echo "$dailyreport_results\n"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/ Share on other sites More sharing options...
requinix Posted January 29, 2016 Share Posted January 29, 2016 Get rid of the @ on that fopen and look for error messages. Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530595 Share on other sites More sharing options...
njdubois Posted February 2, 2016 Author Share Posted February 2, 2016 Sorry, I should have included that little tidbit of information! I have tried that. The error I get is still "false." There wasn't any error output. Using error_get_last() the error output was: fopen(https://secure.bluepay.com/interfaces/bpdailyreport2): failed to open stream: operation failed Additional information: We have the same code on another server and it runs ok. This is definitely a server issue. I have been looking for php.ini requirements for fopen. For both servers, allow_url_fopen is set to local: on master: on And I believe that allow_url_include is also important for fopen, and in both cases again both servers are set to local:off, master: off. Thoughts? Thanks for the assistance! Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530684 Share on other sites More sharing options...
requinix Posted February 2, 2016 Share Posted February 2, 2016 allow_url_include is about trying to do stuff like include("http://..."), which is never acceptable. It doesn't matter here. What if you try equivalent code using cURL instead? Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530689 Share on other sites More sharing options...
Psycho Posted February 2, 2016 Share Posted February 2, 2016 Per the manual, fopen() should return an error of E_WARNING level. Even though you removed the @, I suspect the error reporting is set to a level where warnings are not displayed. Turn on full error reporting and see what is reported. Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530690 Share on other sites More sharing options...
mac_gyver Posted February 2, 2016 Share Posted February 2, 2016 is the openssl extension installed and enabled? you will need it for php to be able to establish a https connection. Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530691 Share on other sites More sharing options...
njdubois Posted February 3, 2016 Author Share Posted February 3, 2016 allow_url_include is about trying to do stuff like include("http://..."), which is never acceptable. It doesn't matter here. What if you try equivalent code using cURL instead? I'm sure that we could re-write the code to use cURL. The code is almost word for word copied from what bluepay is providing, because of this the issue is more "why isn't bluepays code working." Once we have exhusted all other options I think we will have no choice but to attempt another path! Thanks for the reply! Per the manual, fopen() should return an error of E_WARNING level. Even though you removed the @, I suspect the error reporting is set to a level where warnings are not displayed. Turn on full error reporting and see what is reported. DOH, we do have errors being suppressed. At some point today I will enable them and see if we get any more information about this error. Thanks!! is the openssl extension installed and enabled? you will need it for php to be able to establish a https connection. Will have to wait for the server guy to get in on this one. Hope to have an answer for you at some point today! Thanks! Thanks all for the quick responses! We are in the middle of a launch and time is insanely tight. I will try to attempt your suggestions at some point today! Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530701 Share on other sites More sharing options...
njdubois Posted February 5, 2016 Author Share Posted February 5, 2016 Just wanted to fill you in. We ended up using cURL to solve the issue. Thank you all for your time! Quote Link to comment https://forums.phpfreaks.com/topic/300696-fopen-requirements/#findComment-1530802 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.