Board index   FAQ   Search  
Register  Login
Board index PHP Your Scripts

Unexpected T_variable, expecting T_string...

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

Unexpected T_variable, expecting T_string...

Postby Techapprentice87 » Mon Feb 27, 2012 7:03 am

Hi, I'm fairly new to php and was trying to set up a curl cookie code in my script so i could pull some data. This is what I have.


Code: Select all

<?php
   $filename    = "blue.csv";
   $fromHome         = false;
   $debug            = false;
   $URL_FIELD            = 1;
   $SEARCH_FIELD         = 2;
   $FILENAME_FIELD       = 3;
   $NUMBER_OF_FIELDS     = 1;
   $SETS_OF_DATA         = 1;
   $TOTAL_NUMBER_OF_FIELDS = $SETS_OF_DATA * $NUMBER_OF_FIELDS + 1;

   function extractData($headerArray) {
         for ($i = 0; $i < count($headerArray); $i++) {
            $headerArray[$i] = trim($headerArray[$i]);
            $headerArray[$i] = str_replace('""', '"', $headerArray[$i]);
            if (substr($headerArray[$i], 0, 1) == '"') {
               $headerArray[$i] = substr($headerArray[$i], 1, strlen($headerArray[$i]));
            }
            if (substr($headerArray[$i], strlen($headerArray[$i])-1, 1) == '"')
               $headerArray[$i] = substr($headerArray[$i], 0, strlen($headerArray[$i])-1);
         }
         return $headerArray;

      }

      function getDataFromWeb($url) {
         global $debug;
         /*
         ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
         print $_SERVER['HTTP_USER_AGENT'];
         */
         if ($debug) {
            print "Getting content from <$url>\n";
         }
         $file = file_get_contents($url);
         return $file;
   }

            function $ckfile = tempnam ("/tmp", "CURLCOOKIE") {

            $ch = curl_init ("HTTP://http://www.bluedolphin-magazines.com/");
            curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
            $output = curl_exec ($ch);

            $ch = curl_init ("http://www.bluedolphin-magazines.com/cookiepage.php");
            curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile);
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
            $output = curl_exec ($ch);
   }
             function getDataFromFile2($fileName) {
              //$file = file_get_contents($fileName);
              $file = "";
              $fh = fopen($fileName, "r" ) or exit("Unable to open file ($fileName)!");

              while (!feof($fh)) {
             $line = fgets($fh);
             $line = trim($line);
             print "[" . $line . "] " . strlen($line) . "\n";
             $file .= fgets($fh);
         }
         fclose($fh);
         return $file;



Can anyone give me some insight as to why i get Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING or '(' in C:\Documents and Settings\user\Desktop\bluedolphincode\blue.php on line 39

thank you
Techapprentice87
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Feb 21, 2012 7:27 am

Return to Your Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.