Jump to content
Sign in to follow this  
sijimbo

Dynamically formatting URL for input into INETGET

Recommended Posts

sijimbo

I have an array of IP addresses I am using as input.

The program I am writing is to extract an XML file from a device on the network from each of the IP addresses in the array.

This is what I am trying as input:

InetGet("http://"&IP_Array[$x]&"/cgi-bin/getprogrambitrateshistories?scale=1",@ScriptDir & "\test.xml",0, 1)

I have a DO UNTIL loop that moves through the array. The URL is the same on each of these devices but the IP addresses are different. I can configure this statically but I'd rather have it dynamic so that I only poll the device I need at that moment in time.

Any assistance provided would be greatly appreciated.

Share this post


Link to post
Share on other sites
funkey

Wher is the problem?

For $x = 0 To UBound($IP_Array) - 1
 InetGet("http://" & $IP_Array[$x] & "/cgi-bin/getprogrambitrateshistories?scale=1", @ScriptDir & "\test.xml", 0, 1)
Next

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
sijimbo

Wher is the problem?

For $x = 0 To UBound($IP_Array) - 1
 InetGet("http://" & $IP_Array[$x] & "/cgi-bin/getprogrambitrateshistories?scale=1", @ScriptDir & "\test.xml", 0, 1)
Next

I figured it out. The problem was that what I posted was not being accepted by the INETGET function. I solved the problem by creating a variable $URL then used & to concatenated the text I wanted to use as input and then just modified it as so.

$URL = $URL_BEGIN & $IP_Array[$x] & $URL_END

InetGet($URL, @ScriptDir & "\test.xml", 0, 1)

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.