Upload a file on a website [message #88408] |
Tue, 22 April 2014 16:07  |
Michaël Marsset
Messages: 2 Registered: April 2014
|
Junior Member |
|
|
Hi all,
First, thanks a lot for the priceless help you provide with this group! It helped me many times.
Second - of course - I have a question about IDL:
Is it possible to upload a file on a website with IDL ?
Specifically, I work on asteroids, and I usually have to classify them using this website: http://smass.mit.edu/cgi-bin/busdemeoclass-cgi
It's very simple: you upload a spectra, and the website returns the spectral types that better fit your data, and it can send you the results by mail.
Unfortunately it's pretty long to do it manually, especially when you have ~200 spectra to classify! Is there a way to make it quicker with IDL ? One problem is that the website does not changes its URL with keywords unlike, for example SIMBAD or VIZIER for those who know these tools...
Thanks a lot for your help!
Michaël Marsset
PhD Student
ESO/Chile
|
|
|
Re: Upload a file on a website [message #88409 is a reply to message #88408] |
Tue, 22 April 2014 20:15   |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Tuesday, April 22, 2014 5:07:15 PM UTC-6, Michaël Marsset wrote:
> Hi all,
>
>
>
> First, thanks a lot for the priceless help you provide with this group! It helped me many times.
>
>
>
> Second - of course - I have a question about IDL:
>
> Is it possible to upload a file on a website with IDL ?
>
>
>
> Specifically, I work on asteroids, and I usually have to classify them using this website: http://smass.mit.edu/cgi-bin/busdemeoclass-cgi
>
>
>
> It's very simple: you upload a spectra, and the website returns the spectral types that better fit your data, and it can send you the results by mail.
>
>
>
> Unfortunately it's pretty long to do it manually, especially when you have ~200 spectra to classify! Is there a way to make it quicker with IDL ? One problem is that the website does not changes its URL with keywords unlike, for example SIMBAD or VIZIER for those who know these tools...
>
>
>
> Thanks a lot for your help!
>
> Michaël Marsset
>
> PhD Student
>
> ESO/Chile
I don't have any spectral files handy to test it, but my guess is that you can create a simple URL to pass to the first page, at least.
Take a look at the source for the page you reference. Look for the "input" elements, such as "sms". It has the options "smoothed" and "unsmoothed", so it's very much akin to keyword arguments.
The URL constructed from this web page will be turned into a request something like this:
http://smass.mit.edu/cgi-bin/busdemeoclass-cgi?spa=input& ;sfn=c:\\temp\\b.pro&lun=um&sms=unsmoothed&smv=1 .00&tax=ir&sls=sloped&slv=1&int=0
(You can see this if you visit the web page with HTML debugging turned on, and show the network traffic. I'm using IE 11, but I believe most modern browsers have this capability.)
This is a POST request that could be passed via an IDLnetURL object. It would be up to you to parse the result and possibly respond to any error messages or further prompts.
In the end, it's a simple matter of string parsing.
|
|
|
|
Re: Upload a file on a website [message #88426 is a reply to message #88417] |
Wed, 23 April 2014 19:57  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, April 23, 2014 11:38:29 AM UTC-6, Michaël Marsset wrote:
> Many thanks for helping !
>
>
>
> I am not sure if I understood correctly but from what I know there are two types of requests: forward and redirect.
>
>
>
> In the case of this website, it uses forward requests so the URL never changes. You tell me there is a way to see the complete URL ? How do you do that with IE ?
F12 will start up the debugger. Ctrl+4 will bring up the network monitor. F5 will enable network traffic. Fill in the web page you reference then when you submit the request, you can view the details, including the URL that's constructed from the web page contents.
POST and GET are common protocols for HTTP requests, with POST used by that web page.
|
|
|