Need help fixing - Parse error: syntax error, unexpected T_VAR

Discussion in 'PHP' started by Carsen, May 14, 2009.

  1. #1
    <?php
     
    var sentXML:XML = new XML();
    sentXML.addRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2");
    sentXML.ignoreWhite = true;
    
    var wowXML:XML = new XML();
    wowXML.ignoreWhite = true;
    wowXML.onLoad = function(success) {
        if (!success) {
            trace("LOAD NO GOOD");
            wowData_txt.text = "LOAD NO GOOD";
        } else {
            trace("returned: "+wowXML);
            wowData_txt.text = wowXML;
        }
    }
    sentXML.sendAndLoad("http://www.wowarmory.com/character-sheet.xml?r=Gorgonnash&n=Leetamus", wowXML, "POST"); 
    	
    ?>
    Code (markup):
    Yea, so I get an error when I try to run this script
    [B]Parse error:[/B] syntax error, unexpected T_VAR
    Code (markup):
    ...I don't know what I am doing wrong, This should parse data from the World of Warcraft armory. Someone please fix this! Thanks.
     
    Carsen, May 14, 2009 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    is it really running, before you got that error?
    Thats not php, i think its javascript..

    shown in your first line thats a class variable, and is cannot be independent in procedural method.. up to the last line, thats not how you call a class function.
     
    bartolay13, May 14, 2009 IP
  3. Carsen

    Carsen Well-Known Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Yep your right =P just testing you, lol jk...Uh yea, my bad, well I am working on a different script now and this is PHP it uses cURL to fetch the XML file but it doesn't return anything back -

    <?php 
    $url = 'http://www.wowarmory.com/character-info.xml?r=Twisting+Nether&n=Donike';
        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt ($ch, CURLOPT_USERAGENT,  "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
        
        $characterxml = curl_exec($ch);
        
        echo $characterxml;  #ADDED
    ?>
    Code (markup):
     
    Carsen, May 14, 2009 IP
  4. KnuTz

    KnuTz Well-Known Member

    Messages:
    169
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #4
    isnt it character-sheet.xml insteed of character-info.xml anyway im using this to get wow character datas.. will work only on php5
    
    <?php 
    $url = 'http://www.wowarmory.com/character-sheet.xml?r=Barthilas&n=Emeri';
            $ch = curl_init($url);
    		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2');
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
            $page = curl_exec($ch);
         
            $xml = new SimpleXMLElement($page); 
    	 
    	    print '<pre>';
    	    print_r($xml);
    	    print '</pre>';
    ?>
    
    PHP:
     
    KnuTz, May 14, 2009 IP
  5. Carsen

    Carsen Well-Known Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #5
    KnuTz, Thank you so much! That is exactly what it was...
     
    Carsen, May 15, 2009 IP
  6. php_techy

    php_techy Active Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    Hi,
    I hope you are doing good.I guess this is my 5th reminder mail and hope that you get time or pay attention to read this mail.
    Earlier you appeared on messenger but now you have vanished from there also.I don't know whether you are going to reply this mail or not.
    I haven't received my payment of $20 by paypal.I am the one who worked on this site wowarmony, Its 5 months since the work had been delivered to you.
    This is my only source of bread and butter.I am not a single as you are.I have to feed my family,my kids.
    I am running short of money.I have to pay charges for the cyber cafe as I dont have PC.
    Please transfer my fees asap or even half amount first to my paypal account
    Regards
    PHP TECHY
     
    php_techy, Oct 24, 2009 IP