Pharcical Posted October 23, 2016 Share Posted October 23, 2016 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 thatcan 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 varietyof weather related data logging equipment, and "HOBOlink" is the website that they allow for customers to view their loggeddata online.The example page I'm going to be referring to is at the following link:https://www.hobolink.com/p/9546ff7e0eda05efc217348718bd5fa9On the left hand side, under the "Data" pull down menu are a few links that allow you to download a .csv file withdata 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 adialog 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 ahashtag (#) 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 pointme towards the relevant section? I apologize if that sounds a bit lazy, it's that time to solve this problem is limited. Ifit'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! Quote Link to comment https://forums.phpfreaks.com/topic/302389-helpadvise-click-and-download-a-csv-file/ Share on other sites More sharing options...
ginerjm Posted October 24, 2016 Share Posted October 24, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/302389-helpadvise-click-and-download-a-csv-file/#findComment-1538546 Share on other sites More sharing options...
kicken Posted October 24, 2016 Share Posted October 24, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/302389-helpadvise-click-and-download-a-csv-file/#findComment-1538558 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.