External Form Does Not Post to Servlet After PHP Version Upgrade
Permalink
I am working with a very outdated PHP external form. The form is supposed to post the input data to a JAVA-based servlet. However, after upgrading the PHP version from 4 to 7, the data is no longer being posted to the servlet.
Here is the code that is supposed to process and post the data:
I believe it is not working because the PHP version is now on PHP 7. What (if anything) needs to be fixed?
Here is the code that is supposed to process and post the data:
//check required fields $all_required = $company_req . $firstname_req . $lastname_req . $title_req . $phone_req . $email_req ; $request = $request . $all_required; if ($request == 'y') { //post to taskflow servlet $ar['key']='value'; foreach($_POST as $key=>$value) { $postvars.=$key. '=' . urlencode($value) . '&'; $posted_data[$key]=$value; } $postvars=trim($postvars,'&'); $errstr=$errno=''; $fp= @ fsockopen('www.task-manager.net',80,$errno,$errstr,30);
Viewing 15 lines of 37 lines. View entire code block.
I believe it is not working because the PHP version is now on PHP 7. What (if anything) needs to be fixed?
I'd bet that you need to update the allow_url_fopen setting on your updated version of PHP, that's required for fsockopen but many hosts don't turn it on by default because it's a security risk.
Ok, I've checked the phpinfo, and allow_url_fopen is already turned on.
What version of C5 are you working with? I don't know of any officially released versions that work with both PHP 4 and 7
This is for an external form, so the form itself is not using C5, but rather a custom processing script that's very old (using PHP 4, but the server is now on PHP 7).
I guess my best advice then since this isn't actually a C5 question would be to stick error_log statements all over the place, run it, and see what comes out in the error log.
Attached is the full php processing script for the form I'm working with.
Also, I have attached what I get in the error log when the form is submitted.
Any ideas what might be going wrong?
Also, I have attached what I get in the error log when the form is submitted.
Any ideas what might be going wrong?
Put some error_log statements throughout here and then run it again and check the error log. This doesn't show anything helpful.