Variable / String wird auskommentiert



  • Heyhó,

    ich würde gern ein Packet an ein Server schicken.
    Mein Problem ist nun, dass das die hälfte des Packets auskommentiert wird.
    Könnte wer das Packet in eine Variable packen, ohne das Packet zu verfälschen?

    Packet :

    POST /Webservice/Service.asmx HTTP/1.1..Host: www.moviestarplanet.de..User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1..Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8..Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3..Accept-Encoding: gzip, deflate..Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7..Connection: keep-alive..Cookie: __utma=63765683.145396778.1324722135.1325378934.1325596241.40; __utmz=63765683.1324722135.1.1.utmcsr=moviestarplanet.se|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmb=63765683.6.10.1325596241; __utmc=63765683..Referer: http://cdn.moviestarplanet.de/Main_20111220_93824.swf..Content-type: text/xml; charset=utf-8..SOAPAction: "http://moviestarplanet.com/Login2"..Content-length: 411....<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">.  <SOAP-ENV:Body>.    <tns:Login2 xmlns:tns="http://moviestarplanet.com/">.      <tns:username> </tns:username>.      <tns:password></tns:password>.    </tns:Login2>.  </SOAP-ENV:Body>.</SOAP-ENV:Envelope>a
    


  • jedes / zeichen muss du zu einem // machen, ansonsen wird es als kommentar angesehen. guck dir mal an was escape sequenzen sind...



  • Ist aber immernoch auskommentiert ;O



  • dann es in teilstrings auf
    z.b.

    std::string s1 = "POST /Webservice/Service.asmx HTTP/1.1..Host: www.moviestarplanet.de..User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1..Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/";
    
    std::string s2 = "*;q=0.8..Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3..Accept-Encoding: gzip, deflate..Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7..Connection: keep-alive..Cookie: __utma=63765683.145396778.1324722135.1325378934.1325596241.40; __utmz=63765683.1324722135.1.1.utmcsr=moviestarplanet.se|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmb=63765683.6.10.1325596241; __utmc=63765683..Referer: http://cdn.moviestarplanet.de"
    + "/Main_20111220_93824.swf..Content-type: text/xml; charset=utf-8..SOAPAction: \"http://moviestarplanet.com/Login2\"..Content-length: 411....<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">.  <SOAP-ENV:Body>."
    + "    <tns:Login2 xmlns:tns=\"http://moviestarplanet.com/\">.      <tns:username> </tns:username>.      <tns:password></tns:password>.    </tns:Login2>.  </SOAP-ENV:Body>.</SOAP-ENV:Envelope>a	";
    
    std::string url = s1 + s2;
    

  • Mod

    Skym0sh0 schrieb:

    jedes / zeichen muss du zu einem // machen, ansonsen wird es als kommentar angesehen. guck dir mal an was escape sequenzen sind...

    Nö, du darfst in String // benutzen so viel du lustig bist. Das Problem sind die ". Die Lösung ist aber die gleiche: Escapesequenzen.

    "POST /Webservice/Service.asmx HTTP/1.1..Host: www.moviestarplanet.de..User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1..Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8..Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3..Accept-Encoding: gzip, deflate..Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7..Connection: keep-alive..Cookie: __utma=63765683.145396778.1324722135.1325378934.1325596241.40; __utmz=63765683.1324722135.1.1.utmcsr=moviestarplanet.se|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmb=63765683.6.10.1325596241; __utmc=63765683..Referer: http://cdn.moviestarplanet.de/Main_20111220_93824.swf..Content-type: text/xml; charset=utf-8..SOAPAction: \"http://moviestarplanet.com/Login2\"..Content-length: 411....<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:s=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">.  <SOAP-ENV:Body>.    <tns:Login2 xmlns:tns=\"http://moviestarplanet.com/\">.      <tns:username> </tns:username>.      <tns:password></tns:password>.    </tns:Login2>.  </SOAP-ENV:Body>.</SOAP-ENV:Envelope>a"
    


  • So ein Unsinn. In einem String wirds nichts auskommentiert. Wenn es dir so erscheint, dann ist irgendwas anderes falsch.


Anmelden zum Antworten