Highlighted
Absent Member.
Absent Member.
595 views

Executing php from a acucobol cgi

[Migrated content. Thread originally posted on 20 May 2011]

Hello,

I have a website that run with acucobol cgi scripts. Now we want integrate some php code within the pages generated by our cgi scripts. The problem is that the output of the cobol program that runs the cgi (created via displays) is sent directly to navigator and the server does not interpret the php code embedded on page.

As a possible solution we plan to run the php code via call system using "php-p something.php >> outputfile" and then the cobol program to read the file outputfile and integrate it into the page but does not seem a very good solution.


Any help will be appreciated.
0 Likes
3 Replies
Highlighted
Honored Contributor.
Honored Contributor.

RE: Executing php from a acucobol cgi

The problem is that the output of the cobol program that runs the cgi (created via displays) is sent directly to navigator and the server does not interpret the php code embedded on page.


first: sorry for my bad english and i hope i can explain what i would do with a problem like this.

yeah thats the problem and there you must hook to solve the problem 🙂
if i had the problem i would add a ajax/javascript which loads the php data.

Normal way
you visit mypage.acu
server generate the output and
send to the browser

With the javascript
you visit mypage.acu
server generate the output with the ajax part and
send to the browser
the browser gets the command from ajax to load mypage-upgrade.php
mypage-upgrade.php is loaded, send the data to the ajax part
the ajax-part place it at the defined place from your acu-output

--> this is like an iframe without an iframe 😄

i think its the better solution without the need of temp-files.
0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: Executing php from a acucobol cgi

Short example with the use of the jquery-framework (jquery-1.4.1.min.js) - NOT TESTED

Script in the head:

<script type="text/javascript">
    $.ajax({
       type: "GET",
       url: "reload.php?parameter1=<?php echo $_GET['paramerter1']; ?>&parameter2=<?php echo $parameter2; ?>",
       data: "reload",
       success: function(reload){
   
           $('#reload').empty();
           $('<span>'+reload+'</span>').appendTo('#reload');
   
       }
     });   
</script>



Place the php output:

<div id="reload" style='text-align:center;'>

<img src="loading.gif" alt="" />
<br />
<div style='color:grey;'><small>php data is loading...</small></div>
                           
</div>


0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Executing php from a acucobol cgi

Thanks neidingd

It could be a solution. Now we must learn a bit of AJAX to solve it.





0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.