Hello Guys,

I apologized if I may have misplaced this post as I cannot see CURL on any category.

Here is my situation. I am trying to create a batch file which will pull up information from a fleet of devices via its web interface. I am using CURL to do that. The output will be 1 file for each device. I created a text file that lists all the IP address of the devices.

Below is the command I usedd for just one device:

curl http://<IP>/cgi-bin/history > <nameOFfile.txt>

Any help will be much appreciated.

Thanks.

Hi, few questions:

  1. which operative system?
  2. can you use PHP or another scripting language?
  3. you have the IP list, nameOFfile.txt is an arbitrary value or defined in the list?

Hello Cereal,

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.

192.168.1.5
192.168.1.6
192.168.1.7

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.

You might do better is create the output file(s) using the -o operand of curl.
-o printer1.txt
And, you might want to load the IP's into an array and use a loop within the cmd script to access and write all the device info.

Research windows cmd array and also the for commands.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.