Solved

HTTP Post via URL

Posted on 2016-08-22
4
12 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now