<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc http post method - passing parameters problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637166#M189403</link>
    <description>&lt;P&gt;Im afraid my SAS version does not allow it - i found that it&amp;nbsp;&lt;SPAN&gt;is only available starting in SAS 9.4M5.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;using this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http
method="POST"
url="https://logon-website.com/security_check"
in=input
headerout=headers
out=resp;
debug level=2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;causes an error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is there any other way to see the request sent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Apr 2020 06:26:55 GMT</pubDate>
    <dc:creator>HosSu</dc:creator>
    <dc:date>2020-04-03T06:26:55Z</dc:date>
    <item>
      <title>Proc http post method - passing parameters problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/636820#M189248</link>
      <description>&lt;P&gt;I am trying to write a proc http with post method in order to check login possibility to a website (SASCIStudio).&lt;/P&gt;&lt;P&gt;This is the code im using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let username=MyName;
%let pwd=password;
filename input TEMP;
filename resp TEMP;
filename headers TEMP;

/*
Macro that simply echoes the contents of a fileref to the SAS log
*/
%macro echofile(file);
data _null_;
infile &amp;amp;file;
input;
put _infile_;
run;
%mend;
/*
* Create the input file for the request
*/
data _null_;
 file input recfm=f lrecl=1;
 put "username=&amp;amp;username.%nrstr(&amp;amp;password)=&amp;amp;pwd";
run;

%echofile(input);

proc http
method="POST"
url="https://logon-website.com/security_check"
in=input
headerout=headers
out=resp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the echofile macro output:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;username=MyName&amp;amp;password=password
NOTE: 1 record was read from the infile INPUT.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output form in the resp file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form id="fm1" class="form-stacked" onSubmit="return setSubmitUrl(this);" action="https://logon-website.com/security_check" method="post"&amp;gt;
&amp;lt;fieldset&amp;gt;

        &amp;lt;legend&amp;gt;Sign In&amp;lt;sup&amp;gt;&amp;amp;reg;&amp;lt;/sup&amp;gt;&amp;lt;/legend&amp;gt;
    &amp;lt;div class="clearfix"&amp;gt;
            &amp;lt;label for="username"&amp;gt;&amp;lt;span class="accesskey"&amp;gt;U&amp;lt;/span&amp;gt;ser ID:&amp;lt;/label&amp;gt;


                    &amp;lt;input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" size="25" autocomplete="off"/&amp;gt;


    &amp;lt;/div&amp;gt;
    &amp;lt;div class="clearfix"&amp;gt;
            &amp;lt;label for="password"&amp;gt;&amp;lt;span class="accesskey"&amp;gt;P&amp;lt;/span&amp;gt;assword:&amp;lt;/label&amp;gt;


            &amp;lt;input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" size="25" autocomplete="off"/&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/fieldset&amp;gt;
&amp;lt;input type="hidden" name="lt" value="LT-2117-BJYk9XdRaLUPCHpGyDvAC0sxNf6Vd7" /&amp;gt;
&amp;lt;input type="hidden" name="execution" value="e1s1" /&amp;gt;
&amp;lt;input type="hidden" name="_eventId" value="submit" /&amp;gt;
    &amp;lt;div class="submitb"&amp;gt;&amp;lt;input id="Logon" type="submit" value="Sign In" onClick="this.disabled=true;this.form.submit();" tabindex="3" /&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Values of username and password are missing in the output form.&lt;/P&gt;&lt;P&gt;There are no errors as I am getting 200 OK, but i am expecting 302 FOUND. I am using SAS9.4.&lt;/P&gt;&lt;P&gt;Is there a way to properly use the post method and check the login possibility when provided with valid credentials?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 10:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/636820#M189248</guid>
      <dc:creator>HosSu</dc:creator>
      <dc:date>2020-04-02T10:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc http post method - passing parameters problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637130#M189395</link>
      <description>&lt;P&gt;Have you tried setting the &lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0i2ek87s12e7mn1h2q3h0mywkl1.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;debug level&lt;/A&gt; to 1 or 2 to see what's being sent?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 02:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637130#M189395</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-03T02:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc http post method - passing parameters problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637166#M189403</link>
      <description>&lt;P&gt;Im afraid my SAS version does not allow it - i found that it&amp;nbsp;&lt;SPAN&gt;is only available starting in SAS 9.4M5.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;using this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http
method="POST"
url="https://logon-website.com/security_check"
in=input
headerout=headers
out=resp;
debug level=2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;causes an error:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is there any other way to see the request sent?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 06:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637166#M189403</guid>
      <dc:creator>HosSu</dc:creator>
      <dc:date>2020-04-03T06:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc http post method - passing parameters problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637373#M189466</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; Is there any other way to see the request sent?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Only 2 ways I can think of: connect to a web server you control, or use a packet analyzer such as wireshark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fyi, I ran this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let username=MyName;
%let pwd=MyPassword;
filename input TEMP;
filename resp TEMP;
filename headers TEMP;

data _null_;
 file input recfm=f lrecl=1;
 put "username=&amp;amp;username.%nrstr(&amp;amp;password)=&amp;amp;pwd";
run;

proc http
method="POST"
url="https://google.com"
in=input
headerout=headers
out=resp;
debug level=2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and got this:&lt;/P&gt;
&lt;PRE&gt;100        method="POST"
 101        url="https://google.com"
 102        in=input
 103        headerout=headers
 104        out=resp;
 105        debug level=2;
 106        run;
 
 &amp;gt; POST / HTTP/1.1
 &amp;gt; User-Agent: SAS/9
 &amp;gt; Host: google.com
 &amp;gt; Accept: */*
 &amp;gt; Connection: Keep-Alive
 &amp;gt; Content-Length: 35
 &amp;gt; Content-Type: application/x-www-form-urlencoded
 &amp;gt; 
 &amp;gt; 00007F93DA73E260: 75 73 65 72 6E 61 6D 65 3D 4D 79 4E 61 6D 65 26 username=MyName&amp;amp;
 &amp;gt; 00007F93DA73E270: 70 61 73 73 77 6F 72 64 3D 4D 79 50 61 73 73 77 password=MyPassw
 &amp;gt; 00007F93DA73E280: 6F 72 64                                        ord             
 &amp;lt; HTTP/1.1 405 Method Not Allowed
 &amp;lt; Allow: GET, HEAD
 &amp;lt; Date: Fri, 03 Apr 2020 22:01:40 GMT
 &amp;lt; Content-Type: text/html; charset=UTF-8
 &amp;lt; Server: gws
 &amp;lt; Content-Length: 1589
 &amp;lt; X-XSS-Protection: 0
 &amp;lt; X-Frame-Options: SAMEORIGIN
 &amp;lt; Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; 
 ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,h3-T050=":443"; ma=2592000
 &amp;lt; 
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 22:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-http-post-method-passing-parameters-problem/m-p/637373#M189466</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-03T22:05:28Z</dc:date>
    </item>
  </channel>
</rss>

