urlread retrieves data but webread retrieves error
Show older comments
I'd like to retrieve data from a .csv generated by a website. urlread works, but is not recommended. webread returns a http error message. Anyone know what feature of webread causes different behavior than urlread? Alternatively, is there a script to just download the file (e.g. web.m but without the interactive browser)?
>> urlread('https://ssd.jpl.nasa.gov/sbdb_query.cgi?com_orbit_class=JFC;table_format=CSV;c_fields=AbAc;&query=1')
ans =
'spkid,full_name
1000099," 8P/Tuttle"
1000061," 96P/Machholz 1"
1000047," 126P/IRAS"
1000154," 262P/McNaught-Russell"
1003435," 333P/LINEAR"
1002585," 342P/SOHO"
1001439," P/1999 J6 (SOHO)"
1001843," C/2002 R5 (SOHO)"
1001852," P/2002 S7 (SOHO)"
1002413," P/2006 R1 (Siding Spring)"
1003317," P/2008 Y12 (SOHO)"
1003064," P/2010 D2 (WISE)"
1003231," P/2013 AL76 (Catalina)"
1003377," C/2015 D1 (SOHO)"
'
>> webread('https://ssd.jpl.nasa.gov/sbdb_query.cgi?com_orbit_class=JFC;table_format=CSV;c_fields=AbAc;&query=1')
ans =
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>ERROR</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="#FFFFFF" link="#FF0000" vlink="#0000FF">
<h2>Error Condition</h2>
</body>
</html>
Accepted Answer
More Answers (0)
Categories
Find more on Downloads in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!