Different results using URL on browser vs in code lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- fapplin · 2015-10-02 19:27 I generate an URL using the procedure below. If I just take the URL generated and paste it in a browser - I get the results I expected (see after code). If I let the procedure use the URL using HTTP.HTTPMethod('GET', urlStr); - I get part of the results, but not all (see further below). Can anyone explain this? Thanks,  Frank procedure GetPlanetAndSuch(command : String; startDate : String; startTime : String); var   commandStr : String;   urlStr : String;   newStartStr, newStopStr, dateTimeTemp : String;   newStartDT, newStopDT : TDateTime;   HTTP : THTTPSend;   status: boolean;   html : String;   Response : TStringList;   i : integer; begin   case command of       'jupiter' : commandStr := '599';   end;   dateTimeTemp := startDate + ' ' + startTime;   newStartDT := StrToDateTime(dateTimeTemp);   newStopDT := IncDay(newStartDT, 1);   DateTimeToString(newStartStr, 'mm-dd-yyyy hh:mm', newStartDT);   DateTimeToString(newStopStr, 'mm-dd-yyyy hh:mm', newStopDT);   urlStr := 'http://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1' +   '&COMMAND="' + commandStr + '"' +   '&CENTER="coord"' +   '&COORD_TYPE="GEODETIC"' +   '&SITE_COORD="' + FloatToStr(CityInformation.Longitude) + ',' + FloatToStr(CityInformation.Latitude) + ',0"' +   '&MAKE_EPHEM="YES"' +   '&TABLE_TYPE="OBSERVER"' +   '&START_TIME="' + newStartStr + '"' + //startDate + ' ' + startTime + '"' +   '&STOP_TIME="' + newStopStr + '"' + //startDate + ' ' + startTime + '"' +   '&STEP_SIZE="1 d"' +   '&QUANTITIES="1,2,32"' +   '&CSV_FORMAT="YES"';    Response := TStringList.Create;    HTTP := THTTPSend.Create;    try      status := HTTP.HTTPMethod('GET', urlStr);      if status then      begin        Response.LoadFromStream(HTTP.Document);        html := '';        for i := 0 to Response.Count - 1 do            html := html + Response + LineEnding;      end;    finally      HTTP.Free;    end;    PlanetInformation.Name:=command;    PlanetInformation.Details:=html; end;        This is the URL generated that I placed directly in the browser. http://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND="599"&CENTE R="coord"&COORD_TYPE="GEODETIC"&SITE_COORD="- 85.7125,33.5486,0"&MAKE_EPHEM="YES"&TABLE_TYPE="OBSERVER"&START_TIME=" 10-02-2015 15:15"&STOP_TIME="10-03-2015 15:15"&STEP_SIZE="1 d"&QUANTITIES="1,2,32"&CSV_FORMAT="YES" Here is the correct result. ********************************************************************** *********  Revised: Dec 02, 2013              Jupiter                               599  PHYSICAL DATA (updated 2009-Jan-28):   Mass (10^24 kg)       =  1898.13+-.19   Density (g/cm^3)       =  1.326   Equat. radius (1 bar) = 71492+-4 km     Polar radius (km)      = 66854+-10   Volumetric mean radius= 69911+-6 km     Flattening             =  0.06487   Rotation period       = 9h 55m 29.685s  Rot. rate(10^-4 rad/s) =  1.75865   m = w^2a^3/GM         =  0.089195       Hydrostatic flat., fh  =  0.06509   Inferred rot. period  =  9.894+-0.02 hr ks = 3*J2/m            =  0.494   Mom. of inert. I/MRo^2=  0.254          I/MRo^2 (upper bound)  =  0.267   Rocky core mass (Mc/M)=  0.0261         Y factor (He/H ratio)  =  0.18+-0.04   GM (km^3/s^2)         = 126,686,511     GM 1-sigma (km^3/s^2)  = +-100   Equ. grav, ge (m/s^2) = 24.79           Pol. grav, gp (m/s^2)  = 28.34   Geometric albedo      =  0.52           Visual magnitude V(1,0)= -9.40   Vis. mag. (opposition)= -2.70           Obliquity to orbit     =  3.12 deg   Sidereal orbit period = 11.862615 yr    Sidereal orbit period  = 4332.820 d   Mean daily motion     = 0.0831294 deg/d Mean orbit velocity    = 13.0697 km/s   Atmos. temp. (1 bar)  = 165+-5 K        Heat flow/mass (x10^7) = 15 erg/gm*s   Planetary Solar Const =  50.5 W/m^2     Dipole tilt/offset     = 9.6deg/0.1Rp   Escape velocity (km/s)=  59.5           Mag.dip.mom(gauss-Rp^3)= 4.2   A_roche(ice)/Rp       =  2.76           Hill's sphere rad. Rp  = 740 ********************************************************************** ********* ********************************************************************** ********* Ephemeris / WWW_USER Fri Oct  2 11:57:35 2015 Pasadena, USA      / Horizons    ********************************************************************** ********* Target body name: Jupiter (599)                   {source: JUP310} Center body name: Earth (399)                     {source: DE-0431LE-0431} Center-site name: (user defined site below) ********************************************************************** ********* Start time      : A.D. 2015-Oct-02 15:15:00.0000 UT      Stop  time      : A.D. 2015-Oct-03 15:15:00.0000 UT      Step-size       : 1440 minutes ********************************************************************** ********* Target pole/equ : IAU_JUPITER                     {East-longitude -} Target radii    : 71492.0 x 71492.0 x 66854.0 km  {Equator, meridian, pole}    Center geodetic : 274.287500,33.5486000,0.0000000 {E-lon(deg),Lat(deg),Alt(km)} Center cylindric: 274.287500,5321.09250,3504.8280 {E-lon(deg),Dxy(km),Dz(km)} Center pole/equ : High-precision EOP model        {East-longitude +} Center radii    : 6378.1 x 6378.1 x 6356.8 km     {Equator, meridian, pole}    Target primary  : Sun Vis. interferer : MOON (R_eq= 1737.400) km        {source: DE-0431LE-0431} Rel. light bend : Sun, EARTH                      {source: DE-0431LE-0431} Rel. lght bnd GM: 1.3271E+11, 3.9860E+05 km^3/s^2                            Atmos refraction: NO (AIRLESS) RA format       : HMS Time format     : CAL EOP file        : eop.151001.p151223                                        EOP coverage    : DATA-BASED 1962-JAN-20 TO 2015-OCT-01. PREDICTS-> 2015-DEC-22 Units conversion: 1 au= 149597870.700 km, c= 299792.458 km/s, 1 day= 86400.0 s Table cut-offs 1: Elevation (-90.0deg=NO ),Airmass (>38.000=NO), Daylight (NO ) Table cut-offs 2: Solar Elongation (  0.0,180.0=NO ),Local Hour Angle( 0.0=NO ) Table format    : Comma Separated Values (spreadsheet) ********************************************************************** ******************************************  Date__(UT)__HR:MN, , ,R.A._(ICRF/J2000.0), DEC_(ICRF/J2000.0), R.A._(a-app), DEC_(a-app), N.Pole-RA, N.Pole-DC, ********************************************************************** ****************************************** $$SOE  2015-Oct-02 15:15,*,m,10 51 08.39,+08 18 45.7, 10 51 56.51,+08 13 48.3, 268.05710,  64.49709,  2015-Oct-03 15:15,*,m,10 51 54.20,+08 14 14.0, 10 52 42.32,+08 09 16.2, 268.05710,  64.49709, $$EOE ********************************************************************** ****************************************** : : : Using the call to procedure GetPlanetAndSuch(command : String; startDate : String; startTime : String); This is the result I get stored in html. It complains of a date problem (which it didn't complain about using the URL directly in the browser. ********************************************************************** *********  Revised: Dec 02, 2013              Jupiter                               599  PHYSICAL DATA (updated 2009-Jan-28):   Mass (10^24 kg)       =  1898.13+-.19   Density (g/cm^3)       =  1.326   Equat. radius (1 bar) = 71492+-4 km     Polar radius (km)      = 66854+-10   Volumetric mean radius= 69911+-6 km     Flattening             =  0.06487   Rotation period       = 9h 55m 29.685s  Rot. rate(10^-4 rad/s) =  1.75865   m = w^2a^3/GM         =  0.089195       Hydrostatic flat., fh  =  0.06509   Inferred rot. period  =  9.894+-0.02 hr ks = 3*J2/m            =  0.494   Mom. of inert. I/MRo^2=  0.254          I/MRo^2 (upper bound)  =  0.267   Rocky core mass (Mc/M)=  0.0261         Y factor (He/H ratio)  =  0.18+-0.04   GM (km^3/s^2)         = 126,686,511     GM 1-sigma (km^3/s^2)  = +-100   Equ. grav, ge (m/s^2) = 24.79           Pol. grav, gp (m/s^2)  = 28.34   Geometric albedo      =  0.52           Visual magnitude V(1,0)= -9.40   Vis. mag. (opposition)= -2.70           Obliquity to orbit     =  3.12 deg   Sidereal orbit period = 11.862615 yr    Sidereal orbit period  = 4332.820 d   Mean daily motion     = 0.0831294 deg/d Mean orbit velocity    = 13.0697 km/s   Atmos. temp. (1 bar)  = 165+-5 K        Heat flow/mass (x10^7) = 15 erg/gm*s   Planetary Solar Const =  50.5 W/m^2     Dipole tilt/offset     = 9.6deg/0.1Rp   Escape velocity (km/s)=  59.5           Mag.dip.mom(gauss-Rp^3)= 4.2   A_roche(ice)/Rp       =  2.76           Hill's sphere rad. Rp  = 740 ********************************************************************** ********* Bad dates -- start must be earlier than stop !$$SOF COMMAND = "599" CENTER = "coord" COORD_TYPE = "GEODETIC" SITE_COORD = "-85.7125,33.5486,0" MAKE_EPHEM = "YES" TABLE_TYPE = "OBSERVER" START_TIME = "10-02-2015 ---------------------------------------------------------------------- ChrisF · 2015-10-02 20:16 Replace the space characters by %20: ' ' ---> '%20' (without the ' ,of course). Which can be asked to your net library (don't know which one you are using): URLEncode ... And it's probably safer to replace also the " characters with %22, if you're doing it by yourself. Which gives you this for your URL: Quotehttp://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND=%22599 %22&CENTER=%22coord%22&COORD_TYPE=%22GEODETIC%22&SITE_COORD=%22- 85.7125,33.5486,0%22&MAKE_EPHEM=%22YES%22&TABLE_TYPE=%22OBSERVER%22&ST ART_TIME=%2210-02-2015%2015:15%22&STOP_TIME=%2210-03- 2015%2015:15%22&STEP_SIZE=%221%20d%22&QUANTITIES=%221,2,32%22&CSV_FORM AT=%22YES%22 ---------------------------------------------------------------------- fapplin · 2015-10-02 20:44 Thanks!!! That did the trick!