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.
|
|
|