Jump to content

Help/Advise: "click" and download a .csv file


Pharcical

Recommended Posts

Hello everyone,

I am new to PHP, and the web development side of programming in general.
I am looking to find some advice or resources to help me with a problem I have. I want to create a PHP script that
can go a website and "click" a link on the page and "download" the resulting .csv file that is generated.
To be more specific, the website in question is the "HOBOlink" website by the company, Onset. They offer a variety
of weather related data logging equipment, and "HOBOlink" is the website that they allow for customers to view their logged
data online.

The example page I'm going to be referring to is at the following link:
https://www.hobolink.com/p/9546ff7e0eda05efc217348718bd5fa9

On the left hand side, under the "Data" pull down menu are a few links that allow you to download a .csv file with
data collected from an X amount of time.
For instance, the first item, "all rain gauges - 7 days". If you click on that specific piece of data, the website will show a
dialog box that says, "Generating export file, please wait" for a moment before allowing you to save a .csv file to your computer.

So, what I am trying to do is create a PHP script that can somehow download and save a .csv file such as the one I described.
But, I am at a loss as to what is happening. I notice that these buttons do not have a direct URL. They only have the website URL with a
hashtag (#) at the end. I have tried inspecting the element in Firefox, but I am unable to make heads or tails of what still is happening.

So what I am hoping to find out is:
1)What does this all mean?
2)Is this possible to do with PHP?
If so, what resources are there to help me learn how to achieve this? If not, what can I do?

If this is something that happens to be already documented in something like the php manual, for example, could you point
me towards the relevant section? I apologize if that sounds a bit lazy, it's that time to solve this problem is limited. If
it's at all possible to shave a few hours/days/weeks from having to read something front to back, it's greatly appreciated!

Thank you!
 

Link to comment
Share on other sites

What you are describing is SOMEONE else's work to produced a downloaded file. Nothing for you to do here. THEY have the php script (probably) that is sending the file to you. IF I am reading you correctly.

 

Perhaps you are referring to something else. If so, please disregard.

Link to comment
Share on other sites

When you click the links they use some javascript to submit a form that causing the server to generate the CSV then when it's complete some more javascript submits a second form that does the actual download.

 

You'll have to spend some time decoding how this works and build a script that can simulate the forms using PHP.

 

Alternatively ask them if they provide any easier way to get the data. The product page for that logger has a link to some developer documentation regarding API's and the hobolink home page mentions calling them for information about web services.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.