SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: Is there another way to POST apart from response.redirect and XMLHTTP ?

  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there another way to POST apart from response.redirect and XMLHTTP ?

    hello
    is there another way to post data to my provider's server apart from the response.redirect and XMLHTTP ?

    I have tried both,
    problem with response.redirect is taht the user coudl easily tell who my provider is, and XMLHTTP I cant get to read from the other server the request.querystring status

    Any advice ?

    afrika

  2. #2
    SitePoint Enthusiast sumanregmi's Avatar
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Server.transfer??
    Code:
    God give nuts to those who don't have teeth..
    myBlog

  3. #3
    Original Gangster silver trophy SitePoint Award Recipient Thing's Avatar
    Join Date
    Oct 2000
    Location
    Jackson, NJ
    Posts
    4,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Meta refresh.

  4. #4
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    meta refresh is a client side script

  5. #5
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks sumanregmi,
    i checked the server.transfer and server.execute methods out

    http://www.4guysfromrolla.com/webtech/042602-1.shtml
    rgds
    Afrika

  6. #6
    Original Gangster silver trophy SitePoint Award Recipient Thing's Avatar
    Join Date
    Oct 2000
    Location
    Jackson, NJ
    Posts
    4,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He never said it had to be server side. Just giving a different option.

  7. #7
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok,

    Am reading through the server.transfer and server.execute methods.

    Seem to be a better alternative

  8. #8
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm thinking you need to use xmlhttp - just explain better what you mean by querystring and I'll help you to get it working.

    I'd guess that from this post and other posts you've made, you are doing the following:

    - submitting a form (with known data) to a server (http://myserver.com/myurl?a=1)
    - the "querystring" of that server is a=1. You already know that.
    - that server is REDIRECTING to another URL (hence another "querystring")
    - you receive the data from the server but you want part of the URL that was redirected to really.

    If so, here is your code. I am using the MSXML2.ServerXMLHTTP object - you might need to upgrade your server to Microsoft XML 4.0 SP2 (download from Microsoft)

    Code:
    <%
    sURL = "http://myserver/myurl?a=1"
    sForm = "b=1&c=1"
    
    Set oXH = Server.CreateObject("MSXML2.ServerXMLHTTP")
    
    
    ' If you are POSTING a form use this code:
    oXH.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    oXH.open "POST", sURL, False
    
    ' If you are GETTING a page use this code:
    oXH.open "GET", sURL, False
    
    
    oXH.send sForm
    
    If oXH.status <> 200 Then
    	Response.Write "Status Error " & oXH.status
    	Response.End
    End If
    
    sResult = oXH.responseText
    
    sFinalURL = oXH.getOption(-1) ' -1 = SXH_OPTION_URL
    
    Response.Write "The final page URL (after any redirects) is " & sFinalURL & "<br/>"
    Response.Write "HTML of the page is <textarea>" & sResult & "</textarea>"
    %>

  9. #9
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am hosting with my hosting provider, running win2k and IIS 5.0

    Yes you are right.

    Basically.
    1. A user post his sms message to my website
    2. MY site authenticates his credits and posts the data to my provider, which can be done via redirect or XMLHTTP
    3. My provider's site posts the data and returns a code
    - 100 means no credits on my account
    -200 successful
    -300 network cannot be found
    -400 all carriers down

    I am meant to be able to receive any of these posts and return to the user.

    so far it works with the post, but reading the return variable is what i am having difficulty wiht. i normally get the error, access denied

    I would try the above script and let you know

  10. #10
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get unspecified error
    line 10

    <%
    sURL = "http://myserver/myurl?a=1"
    sForm = "b=1&c=1"

    Set oXH = Server.CreateObject("MSXML2.ServerXMLHTTP")


    ' If you are POSTING a form use this code:
    LINE 10 >> oXH.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    oXH.open "POST", sURL, False

    ' If you are GETTING a page use this code:
    oXH.open "GET", sURL, False


    oXH.send sForm

    If oXH.status <> 200 Then
    Response.Write "Status Error " & oXH.status
    Response.End
    End If

    sResult = oXH.responseText

    sFinalURL = oXH.getOption(-1) ' -1 = SXH_OPTION_URL

    Response.Write "The final page URL (after any redirects) is " & sFinalURL & "<br/>"
    Response.Write "HTML of the page is <textarea>" & sResult & "</textarea>"
    %>

  11. #11
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If i take out line 10

    i get parameter incorrect line 26

    LINE 26 >>
    sFinalURL = oXH.getOption(-1)
    Last edited by afrika; Mar 17, 2005 at 03:58.

  12. #12
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My fault,

    Cut from MSXML docs:

    Note You must call the open method before you call setRequestHeader method. Otherwise, an error will occur.
    so, switch line 10 and 11 =)

  13. #13
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LINE 26 >> sFinalURL = oXH.getOption(-1) ' -1 = SXH_OPTION_URL


    msxml3.dll error '80070057'

    The parameter is incorrect.

    /jim.asp, line 26

  14. #14
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jim,
    Am still getting an error on line 26

    any assistance with this ?

    thanks in advance

  15. #15
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked the docs again, and regarding using getOption(-1) it says:
    The URL, however, cannot be read until the open method is next called.
    So, I'd try adding a (fake) open just before the getoption line, something like:

    oXH.open "GET", sURL, False
    sFinalURL = oXH.getOption(-1) ' -1 = SXH_OPTION_URL

    Let me know if that works.

  16. #16
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same error
    I was also doing some reading on the side about XML and its says it only works in IE 5 and above, so i wonder what would happen to other browsers

    Same error below

    LINE 26 >> oXH.open "GET", sURL, False
    LINE 27 >> sFinalURL = oXH.getOption(-1) ' -1 = SXH_OPTION_URL

  17. #17
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry

    msxml3.dll error '80070057'

    The parameter is incorrect.

    /jim.asp, line 27

  18. #18
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't be getting msxml3 errors with
    MSXML2.ServerXMLHTTP
    are you using the right component?

  19. #19
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK I got it working - kind of. It was creating an MSXML3 object. This example works, try it with your target URL.
    Code:
    <%
    sURL = "http://www.latlink.net"
    
    Set oXH = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
    
    oXH.open "GET", sURL, False
    oXH.send
    
    If oXH.status <> 200 Then
    	Response.Write "Status Error " & oXH.status
    	Response.End
    End If
    
    sResult = oXH.responseText
    sFinalURL = oXH.getOption(-1)
    
    Response.Write "The final page URL (after any redirects) is " & sFinalURL & "<br/>"
    Response.Write "HTML of the page is <textarea>" & sResult & "</textarea>"
    %>

  20. #20
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yessssssssssssssssssssssssssssssssssssssssss Sir,

    It finally worked.

    thanks a million,

    opps
    sorry, we are using enterprise db here, so i could say
    THANKS A ZILLIONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

    Afrika

  21. #21
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    However Jim, if i may ask, what documentation are u using?

    I do understand that XMLHTTP, dont work with other browsers except IE 5.0 ?

    Is this correct esp for the 3.0 object of XML

  22. #22
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just tested it on Opera, and it works well. so i guess its really ok then

  23. #23
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Afrika,

    Since we're using it as a server side component, the browser doesn't matter.

    It's possible to use xmlhttp in browsers through javascript (similar to what Google Suggest does) but we're not doing that =)

  24. #24
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok,
    I was wondering, cos one documentation i read said it was compatible with certain browsers.

    Also i was wondering why, the response.redirect could be read by a client. I also thought it was a server side component, until i started to use it to send secret info and saw its visible to all.

    I really am not good with jscript. I stick only to VB, although we have 2wizards inhouse with jscript. For server side i stick to vb script

  25. #25
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The documentation for MSXML can be installed when you install the component by the way - it's not selected by default though.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •