This is for a Windows OS. I am not familiar with PHP. Hence, I only use CURL. I have provided an example of IPs below. You can just simply save this as a text file.
So, what is going to happen is I will create a batch file that would call something like this:
curl http://192.168.1.5/cgi-bin/history > printer1.txt
Printer1.txt will be the output. The output contains the values generated from the web interface of 192.168.1.5.
Thanks for the help.