webwrite returns status 405 "Method not Allowed"
13 次查看(过去 30 天)
显示 更早的评论
Hi Everyone,
I work in x-ray scattering and have to reference various material properties often. I'd like to try to automate this process by being able to directly download the data from this online database and assign it to a variable or two in matlab. The issue I'm having is this database requires user input before it will lookup or calculate the needed results. Here is an example of this form: http://henke.lbl.gov/optical_constants/pert_form.html
I'd like a funtion in MATLAB that would take the two user intput 'Element' and 'Energy' and submit them to this form and return all the information under the 'Atomic Proeprties' and 'Material Properties' sections of the next page.
I've been quickly overwhelmed by the properties of webread/webwrite and all the RESTful web services or JSONs. All I've been able to do so far is read in the html file by calling
response = webread('http://henke.lbl.gov/optical_constants/pert_form.html')
From what I've read, it seems like this database is using POST to request data from the user, but I haven't been able to successfully post anything to this form. When I try to post with webwrite I get the following error
>> webwrite('http://henke.lbl.gov/optical_constants/pert_form.html','post',{'Element','Si'})
Error using readContentFromWebService (line 46)
The server returned the status 405 with message "Method Not Allowed" in response to the request to URL
http://henke.lbl.gov/optical_constants/pert_form.html.
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
I'm not sure what exactly the issue is or how to proceed. Any adviced is greatly appreciated.
1 个评论
J E
2022-9-13
编辑:Rena Berman
2022-9-13
I'm having the same issue - did you ever find a solution? Thanks! 2
回答(1 个)
Madheswaran
2024-11-19,9:05
编辑:Madheswaran
2024-11-19,9:05
I assume that you would like to get the X-Ray properties of the different elements from https://henke.lbl.gov/optical_constants/pert_form.html. However you are making a direct post call to the site, which the server rejects it. As you can notice from the website when you submit the querry, a post call with the filled form data is sent to https://henke.lbl.gov/cgi-bin/pert_cgi.pl.
You can get the X-Ray properties of the element with the following MATLAB Command:
data = "Element=Si&Energy=1000";
response = webwrite('https://henke.lbl.gov/cgi-bin/pert_cgi.pl', data);
For more information, refer to the following documentation: https://mathworks.com/help/matlab/ref/webwrite.html
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!