- 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

