download data from internet
Posted
#1
(In Topic #169)
Trainee
Posted
Guru

There is the easy way to do this in Gambas using tools you probably already have installed on your system. The following example uses curl and wget to go and get your external IP address but one or both will need to be installed on your system.
Then there is the harder way, the following code requires gb.net.curl. To activate this component you will need to go to the Gambas menu Project>Properties>Components and activate gb.net.curl. This code does the same as the above.
Code (gambas)
If you go to the Gambas Farm and download Your_location (I need to get the downloads up!
Posted
Trainee
my problem is that i need to login, then navigate to the correct url, unless there is some way to shortcut that, if i just try to go directly to the download i am redirected to the login page
can i pass parameters to the url to bypass the login page?
Posted
Trainee
so far i have been unable to find any link to the farm, the search on gambas one does not seem to be working, the gambasfarm.org does not seem to have the samples(I need to get the downloads up!
do you have a direct link to it?
also thanks for your reply and samples
Posted
Guru

Regarding adding login in details you need to add the details to the URL
Code
https://xxx.university.edu/portal/server.pt?userName=SomeUser&password=somePasswordIf you need more help click here
https://www.google.com…QBQgkKAA&biw=1915&bih=936
Posted
Regular

Logging in by a form on a website, or the "pop-up" box that comes with web browsers?
For the first scenario I believe you can use Curl's HTTP FORM component:
/comp/gb.net.curl/httpform - Gambas Documentation
(I am not sure if it can handle sessions. If it can't it will not work. It seems there might be a possibility to store the session in a cookie, and then load it again)
For the second you can use Curl's password property:
/comp/gb.net.curl/curl - Gambas Documentation
Posted
Trainee
Posted
Trainee
Code (gambas)
Posted
Regular

However, I do not think this is the normal way this kind of operation normally is done. Your webiste should have some API that your program can talk to, and get a JSON/XML/CSV file from. But that again depends on if this is your website?
If it is your webiste, I would probly create a folder that is password protected with HTACCESS/HTPASSWD (if using Apache?) that has a .php file (or what ever language you are using) that spits out a JSON file.
Posted
Trainee
not my web site, i am trying to get the usage data from my isp, so i can display as graph, afaik they have no api or other to get the dataif this is your website?
there is an option on the url xml=yes, but that only returns a summary of the data, not the detail and still requires to login first
i have successfully returned and parsed the data using vb, but now am trying to get the same working for linux
while there would be thousands of examples using several methods for vb, i can find almost nothing for gambas, or even other linux commands (curl or wget) i could shell to
though on further searching through the farm (and google) i have found several other working (or not) examples that are helping me with other parts
Posted
Regular

westconn said
… still requires to login first
…i have successfully returned and parsed the data using vb, but now am trying to get the same working for linux…
I think you are saying that you cannot provide the login details via Gambas. If so, can you post that part of your VB code that allows you to log-in? This may allow us to come up with a Gambas alternative.
Posted
Trainee
now to start on the next unknowns
parsing the data
graphing the data
creating a trayicon
such a lot for a slow learner………..
thank you all for replies and assistance
1 guest and 0 members have just viewed this.





