Solved

HTTP Post via URL

Posted on 2016-08-22
4
19 Views
Last Modified: 2016-09-23
I have the below code i have been using for ages, that long that ive forgotten how to submit information via a URL to it rather than through an app.

Can anyone let me know what i have to type to get info out on the other end please.


<%
Dim TN,FN,SN,TL,EM,PC,NT,CT,ES,RV,LT,TT,AT,RF, stext

Dim fs, file

fs=Server.CreateObject("Scripting.FileSystemObject")
file=fs.CreateTextFile("C:\test\upload\" & request.form("Reference") & ".txt",true)

TN = request.form("TradingName")
FN = request.form("firstname")
SN = request.form("surname")
TL= request.form("Tel")
EM = request.form("Email")
PC = request.form("PostCode")
NT = request.form("Notes")
CT = request.form("CompanyType")
ES = request.form("Established")
RV = request.form("Revenue")
LT = request.form("LeadType")
TT = request.form("TTD")
AT = request.form("ATV")
RF = request.form("Reference")

AT = Replace(AT, "#"  , "")
AT = Replace(AT, """"  , "")
AT = Replace(AT, "£"  , "")
AT = Replace(AT, "&quot;", "")
AT = Replace(AT, "&lt;"  , Chr(60))
AT = Replace(AT, "&gt;"  , Chr(62))
AT = Replace(AT, "&amp;" , Chr(38))
AT = Replace(AT, "&nbsp;", Chr(32))

file.write("""")
file.write(TN)
file.write(""",""")
file.write(FN)
file.write(""",""")
file.write(SN)
file.write(""",""")
file.write(TL)
file.write(""",""")
file.write(EM)
file.write(""",""")
file.write(PC)
file.write(""",""")
file.write(NT)
file.write(""",""")
file.write(CT)
file.write(""",""")
file.write(ES)
file.write(""",""")
file.write(RV)
file.write(""",""")
file.write(LT)
file.write(""",""")
file.write(TT)
file.write(""",""")
file.write(AT)
file.write(""",""")
file.write(RF)
file.write("""")


file.close
file=nothing
fs=nothing
 %>

Open in new window

Post Completed
0
Comment
Question by:CaptainGiblets
  • 2
4 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 41765513
>Can anyone let me know what i have to type to get info out on the other end please.

Where you see request.form("some_name") that is a form field name that has to be posted.

As example
file=fs.CreateTextFile("C:\test\upload\" & request.form("Reference") & ".txt",true)

Open in new window


refers to a file and that file has a name that you provide via the form field called, "Reference".  If the reference field is submitted as "abc_test" then the code would look for C:\test\upload\abc_test.txt.
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 41765527
the code works, we have a 3rd party sending us information on a daily basis, however i need to make some changes to the coding to remove quote marks, i am sure i used to test what information came through by typing in the URL and then ?reference=123456&firstname=Testing

however this is currently just bringing up a blank file.
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 41765543
That's correct.  The code is looking for a form post (request.form).  If you used ?reference=123456&firstname=Testing the page would need to change from request.form to request.querystring.

Recreate a form with those form field names and post to that page to test.

I suggest a function to clean remove your quotes.  Then instead of
TN = request.form("TradingName")

Open in new window

you can use
TN = function clean_html(request.form("TradingName"))

Open in new window

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question