100% ASP Newbie

Discussion in 'C#' started by woostar, Dec 3, 2006.

  1. #1
    Hi folks, here's hoping someone out there can help ~
    I'm a php peep (a novice at that) so I have no idea about asp. I've recently found out that a certain task I've been trying to accomplish in php is so much easier to do in asp.

    Here is a general idea of what I'm trying to do


    I'm trying to get xml from a website and replace one of the data fields before carrying on with the rest of the script, ie:-

    I'm using this code to get xml from kelkoo:-

    Dim xmlrequest
    Set xmlrequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
    xmlrequest.open "GET", strQuery, False
    xmlrequest.setRequestHeader "Content-type", "text/xml"
    xmlrequest.send
    
    Code (markup):

    This is the kellkoo xml it returns:-
      <?xml version="1.0" encoding="UTF-8" ?> 
    - <productSearch>
    - <header>
    - <offset>
    - <![CDATA[ 1
      ]]> 
      </offset>
    - <numShops>
    - <![CDATA[ 73
      ]]> 
      </numShops>
    - <searchTime>
    - <![CDATA[ 10
      ]]> 
      </searchTime>
    - <numTotalResults>
    - <![CDATA[ 3634
      ]]> 
      </numTotalResults>
      </header>
    - <resultList nbResults="2">
    - <result>
    - <offerTitle>
    - <![CDATA[ PSP (Base Pack, Value Pack & Giga Pack With Game)... (PSP)
      ]]> 
      </offerTitle>
    - <merchantName>
    - <![CDATA[ Fone Planet
      ]]> 
      </merchantName>
    - <price>
    - <![CDATA[ 144.99
      ]]> 
      </price>
    - <merchantURL>
    - <![CDATA[ http://www.kelkoo.co.uk/ctl/exportMerchant?partner=kelkoo&partnerId=XXXXXXXXX&param=eJwtkF9rwyAUxb9KXiotWa1-oiYDKayDvo1C2fZYbGLbkDRKYsge-PDTpIh4jpd77uWXUZQJQjEmGOGxyRa7PZ1P8aYrkn_oQacnVTYrckh-VDsuLpR4eqzvanG-tXukR-XUK1LMb3ow3WBaHSO_m-RsdRlKc-CXnrY2NKm79g-n7PtuV7YNdL2qdGXGa6t7WJpn_KzLZm8lQwwzoCQtwhHgLjEPS-IcAW1r_Zoz7EI0GPtWviKnaYI302nbqk67ObDSNzW2DqrB7oeHmWzYQNreVGPp6u5mYgHYupIYISJ4Aa5RU5YBFcThUwBjnfT6z5reXQIwRBC9YMwZFpSyImfFhbBccMy48AtTj2mGKM5z-2LrcZbBovBh3WQd4SYR4Fsyo511ApIIdtERbBKBbiCEyTp0bTzynfH-dCmHMg!!&searchId=export_1010203_1165173359859_258761567
      ]]> 
      </merchantURL>
    - <compareURL>
    - <![CDATA[ http://www.kelkoo.co.uk/ctl/do/compare?catId=112101&pid=13403188&kpartnerid=XXXXXXX&partner=kelkoo
      ]]> 
      </compareURL>
    - <description>
    - <![CDATA[ PSP Value Pack the latest in gaming technology with Free silicon protective case.
      ]]> 
      </description>
    - <deliveryCost>
    - <![CDATA[ £8.99
      ]]> 
      </deliveryCost>
    - <mediumImage>
    - <![CDATA[ http://img.kelkoo.com/uk/medium/810/377/00139661400512344737659130127452609377810.jpg
      ]]> 
      </mediumImage>
    - <smallImage>
    - <![CDATA[ http://img.kelkoo.com/uk/small/810/377/00139661400512344737659130127452609377810.jpg
      ]]> 
      </smallImage>
      </result>
    - <result>
    - <offerTitle>
    - <![CDATA[ PSP (Black) (PSP)
      ]]> 
      </offerTitle>
    - <merchantName>
    - <![CDATA[ OneDayMobile
      ]]> 
      </merchantName>
    - <price>
    - <![CDATA[ 150.00
      ]]> 
      </price>
    - <merchantURL>
    - <![CDATA[ http://www.kelkoo.co.uk/ctl/exportMerchant?partner=kelkoo&partnerId=XXXXXXX&param=eJwtjksKgzAURbfiRKgU43uJ_dhhF1CELkCsBix_IhKJhbf4Wu3gDs6dnCNVbgwXiBwB116emJbP8rdrzM19qJs_5sXxPWxI58W1a_Op836_ZVkIgbnJtvVndK-3YFnj2Npnm0YA1vlxILvNbvHVLgAOokJUErUQsjCyqLg0WqFUms4GQpGDQGPo30IogQHQro8uR0wSXXZICGhy9AVRJTfG&searchId=export_1010203_1165173359859_258761567
      ]]> 
      </merchantURL>
    - <compareURL>
    - <![CDATA[ http://www.kelkoo.co.uk/ctl/do/compare?catId=112101&pid=13403188&kpartnerid=XXXXXXXX&partner=kelkoo
      ]]> 
      </compareURL>
    - <description>
    - <![CDATA[ The PSP systemÂ’s dazzling widescreen LCD brings gaming to life. Whether reaching your personal best...
      ]]> 
      </description>
    - <deliveryCost>
    - <![CDATA[ £4.99
      ]]> 
      </deliveryCost>
    - <mediumImage>
    - <![CDATA[ http://img.kelkoo.com/uk/medium/280/224/0075831447040132365978509822279957224280.jpg
      ]]> 
      </mediumImage>
    - <smallImage>
    - <![CDATA[ http://img.kelkoo.com/uk/small/280/224/0075831447040132365978509822279957224280.jpg
      ]]> 
      </smallImage>
      </result>
      </resultList>
      </productSearch>
    Code (markup):



    and I want to replace all merchantURL<![CDATA> with just the &param and &searchId= variable.



    for example; I want to replace this:-
    <![CDATA[ http://www.kelkoo.co.uk/ctl/exportMerchant?partner=kelkoo&partnerId=XXXXXX&param=eJwtjksKgzAURbfiRKgU43uJ_dhhF1CELkCsBix_IhKJhbf4Wu3gDs6dnCNVbgwXiBwB116emJbP8rdrzM19qJs_5sXxPWxI58W1a_Op836_ZVkIgbnJtvVndK-3YFnj2Npnm0YA1vlxILvNbvHVLgAOokJUErUQsjCyqLg0WqFUms4GQpGDQGPo30IogQHQro8uR0wSXXZICGhy9AVRJTfG&searchId=export_1010203_1165173359859_258761567
      ]]> 
    Code (markup):
    With this:-
    <![CDATA[ param=eJwtjksKgzAURbfiRKgU43uJ_dhhF1CELkCsBix_IhKJhbf4Wu3gDs6dnCNVbgwXiBwB116emJbP8rdrzM19qJs_5sXxPWxI58W1a_Op836_ZVkIgbnJtvVndK-3YFnj2Npnm0YA1vlxILvNbvHVLgAOokJUErUQsjCyqLg0WqFUms4GQpGDQGPo30IogQHQro8uR0wSXXZICGhy9AVRJTfG&searchId=export_1010203_1165173359859_258761567
      ]]> 
    Code (markup):





    I then display the results like this:-
    
    xml.loadxml(xmlrequest.responseText)
    xsl.load(Server.MapPath(".") & "\results.xsl")
    
    response.write xml.transformNode(xsl)
    Code (markup):
    (results.xsl is just formatting to put all the data in the right place)



    Does that make any sense at all?







    Any help would be great :D
    Thanks


    W.>
     
    woostar, Dec 3, 2006 IP
  2. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Went over my head, what do you actually want to do?

    I think you want to get the &param and &Search values from the POST URL and replace the <![CDATA>.

    Get me on PM, if youd like dedicated assistance.

    Talker
     
    Talker, Dec 5, 2006 IP