Results 1 to 2 of 2

Thread: Unexpected T_VARIABLE

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    183

    Unexpected T_VARIABLE

    I can't figure this error out. When I run the script, it says "Parse error: unexpected T_VARIABLE on line 42." Here's the code, with spaces removed and line 42 bolded:
    Code:
    <html>
    <head>
    <title>Arrivals</title>
    </head>
    <body>
    <?php
    $xmlValues;
    $ch = curl_init();
    // set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, "http://www.sanantonio.gov/Aviation/flightstatus2/arrivals-portrait_1.html");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    // load page contents into $output
    $output = curl_exec($ch);
    // set URL to page 2
    curl_setopt($ch, CURLOPT_URL, "http://www.sanantonio.gov/Aviation/flightstatus2/arrivals-portrait_2.html");
    // Add the contents of page 2 to $output
    $output += curl_exec($ch);
    // close cURL resource, and free up system resources
    curl_close($ch);
    // remove unnecessary tags
    $output = strip_tags($output,'<img><tr><td><p>');
    // remove JavaScript
    $output=preg_replace('#<script[^>]*>.*?</script>#is','',$output);
    // Parse the page as if it were an XML file
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $output, $inArray, $outArray);
    xml_parser_free($parser);
    // Write the contents of $outArray to the page.
    $i = 0;
    while ($i <= count($outArray))
    {
    $city = $outArray[$i]['value']
    $i = $i + 1;
    $airline = $outArray[$i]['value'];
    $i = $i + 1;
    $flightNum = $outArray[$i]['value'];
    $i = $i + 1;
    $flightTime = $outArray[$i]['value'];
    $i = $i + 1;
    $gate = $outArray[$i]['value'];
    $i = $i + 1;
    $remark = $outArray[$i]['value'];
    $i = $i + 1;
    $handicaps = $outArray[$i]['value'];
    $i = $i + 1;
    echo("City: " . $city);
    echo("<br>Airline: " . $airline);
    echo("<br>Flight #: " . $flightNum);
    echo("<br>Flight Time: " . $flightTime);
    echo("<br>Gate: " . $gate);
    echo("<br>" . $remark);
    echo("<br>Handicaps: " . $handicaps);
    $i = $i + 1;
    echo("<br><br>");
    };
    ?>
    </body>
    </html>

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    183

    Re: Unexpected T_VARIABLE

    UPDATE: Seems I missed a semicolon somewhere. It's been fixed now.

Posting Permissions

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



Click Here to Expand Forum to Full Width