mardi 28 juin 2016

what to use to replace proc_open?

my host has blocked proc_open and popen functions for security reasons, they said they cannot do anything to let me use them, so the question is: what can I use to replace those functions? Basically, this PHP plugin, that I have allows me to echo what python is printing, with a shortcode. This is the code:

<?php # -*- coding: utf-8 -*-
/* Plugin Name: day7 */                 
header('Content-Type: text/html; charset=cp1252');
add_shortcode( 'day7', 'execute_python_with_argv' );    
function execute_python_with_argv(){            
ob_start();
$description = array (     
0 => array("pipe", "r"),  // stdin
1 => array("pipe", "w"),  // stdout
);
$application_system = "python ";
$application_path .= plugin_dir_path( __FILE__ );
$application_name .= "day7.py";             
$separator = " ";
$application = $application_system.$application_path.$application_name.$separator;
$pipes = array();
$proc = proc_open ( $application , $description , $pipes );
if (is_resource ( $proc ))
{
echo stream_get_contents ($pipes [1] ); //Reading stdout buffer
}
$output = ob_get_clean();
return $output;
}

Any help would be appreciated, thanks for reading.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire