?
Solved

HTTP Post via URL

Posted on 2016-08-22
4
Medium Priority
?
29 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 2000 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 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 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