Sign in to follow this  
Followers 0
jontrac

[Need Help] Get values of text file from website

3 posts in this topic

Hi guys,

I'm just a very beginner in coding. I would like to do the following tasks.

I have a text file named "list.txt" which is located in http://demo.com/list.txt

The content of the text file is:

person_a, 100

person_b, 200

person_c, 300

In my script, I have a variable named: $person = "person_b".

Is there anyway I can check if "person_b" exists in the "list.txt" file? And if it exists, how can I get the number next to it (which is 200)?

Thanks a lot for your help!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Download the file using

InetGet;or
InetRead

use _FileReadToArray (you need all parameters)

sort the file using _ArraySort (only needed if you want the next higher number)

serch for the person using _ArraySearch

the returned index+1 is the person you want.

Edited by AutoBert
1 person likes this

Share this post


Link to post
Share on other sites

Thanks AutoBert. It helps so much!

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  
Followers 0