I have a scraper which scrape one site (Written in python). While scraping the site, that  print lines which are about to write in CSV. Scraper has been written in Python and now I want to execute it via PHP code. My question is 

how can I print each line which is getting printed by python code. 

I have used exec function but it is none of my use and gives output after executing all the program. So;

Is it possible to get python output printed while it is getting executed via PHP.
Simply use system() instead of exec(). exec() saves all lines of stdout output of the external program into an array, but system() flushes stdout output "as it happens".
Print Python output by PHP Code