0

I wrote a service class called search_categorization_service.php. Now I am making a call to python scrpt in this class

class SearchCategorizationService
{
    function searcher($query)
    {
    $tmp=passthru("python serverscript1.py $query");
    ob_start();
    $out=ob_get_contents(); 
    echo print_r($out,true);
    }
}

but i dont get any output on the browser. i tried returning it to a controller class and printing the output but it just wont work.any help wud be appreciated. is it an issue with cakephp? because the same application works fine in normal php.

1 Answers1

1

Try moving ob_start() above $tmp=passthru("python serverscript1.py $query");. It appears nothing is being output after the output buffer is started.

<?php
class SearchCategorizationService
{
    function searcher($query)
    {
    ob_start();
    $tmp=passthru("python serverscript1.py $query");
    $out=ob_get_contents(); 
    echo print_r($out,true);
    }
}
?>
kuujo
  • 7,785
  • 1
  • 26
  • 21