Date: Thu, 10 Aug 2000 10:38:57 -0700
Reply-To: Jay Zhou <zhou_jay@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jay Zhou <zhou_jay@YAHOO.COM>
Subject: Re: Tip: Posting data to a form on a web page and retrieving the
results programmatically
Content-Type: text/plain; charset=us-ascii
Very impressive!
Thanks a lot, David!
Jay
--- "David L. Ward" <dward@SASHELP.COM> wrote:
> While responding to a list question off-list, I
> managed to put together a real example of how to use
> the socket access method to POST data to a page on
> the internet and retrieve the results. Here is an
> example:
>
> filename contract SOCKET 'www.tfc-charts.w2d.com:80'
> termstr=lf;
> data _null_;
> infile contract lrecl=1000;
> file contract;
> ** SEND THE HTTP HEADER COMPLETE WITH FORM DATA AND
> COOKIES **;
> if _n_=1 then put 'POST /chart/TR/C0/ HTTP/1.1' /
> 'Host: 216.25.139.217' / /* MAKE SURE THIS IP
> ADDRESS POINTS TO EITHER YOUR COMPUTER OR A PROXY */
> 'Cookie: Czdpref=b%2Bf%2Bf%2bf%2B' /
> 'Content-Type: application/x-www-form-urlencoded' /
> 'Content-Length: 67' // /* SEND A BLANK LINE */
>
'saveprefs=f&xshowdata=t&xCharttype=b&xhide_specs=f&xhide_analysis=f'
> /;
> ** SEND A FINAL BLANK LINE TO TELL THE SERVER THE
> HEADER IS DONE **;
> input;
> file log;
> *file 'c:\temp\temp.htm' lrecl=1000;
> put _infile_;
> run;
>
> I added the comments in this email, so if they screw
> up the code, forgive me.
>
> Hope this proves useful.
>
> David Ward
> SASHelp.com
>
>
>
>
_____________________________________________________
> Sent by SASHelp.com user David L. Ward
> SASHelp.com - On-Line SAS Resources
> Web interface to SAS-L at
http://www.sashelp.com/sasl
__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
|