Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/t/u/l/tulumbo/html/browse.php on line 356 I am getting this warning on my website. I know this is probably very simple but I am a php newbie. Please help. Here is line 356: public $status = 0; // HTTP status code
yes and yes. thanks for the quick response. class cURL { # Debug data # public $cookiesSent = array(); # public $cookies = array(); # public $posted = ''; # End debug public $status = '0'; // HTTP status code public $headers = array(); // Record headers for later use public $error = false; // Hold cURL error public $abort = false; // Our errors / reason for abortion public $return; // Store the return public $proxyOptions = array(); // Store our proxy browsing options public $docType = 0; // Corresponding parser (from content type) public $cacheName; // Name of cache file to save as (false for no cache) public $fileHandle; // Handle for cache file public $length = 0; private $endHeaders = true; // Flag for end of headers, checked in readBody public function __construct($toLoad,$curlOptions,$options,$cache) { // Set proxy options $this->proxyOptions = $options; // And cache name $this->cacheName = $cache; # Debug # $this->posted = isset($curlOptions[CURLOPT_POSTFIELDS]) ? $curlOptions[CURLOPT_POSTFIELDS] : ''; # $this->cookiesSent = isset($curlOptions[CURLOPT_COOKIE]) ? $curlOptions[CURLOPT_COOKIE] : array(); # End debug // Set our callbacks $curlOptions[CURLOPT_HEADERFUNCTION] = array(&$this,'readHeaders'); $curlOptions[CURLOPT_WRITEFUNCTION] = array(&$this,'readBody'); // Start curl handle $tmp = curl_init($toLoad); // Set our options if ( function_exists('curl_setopt_array') ) curl_setopt_array($tmp,$curlOptions); else foreach ( $curlOptions as $option => $value ) curl_setopt($tmp,$option,$value); // Get return curl_exec($tmp); // Close file handle if ( $this->fileHandle ) { fclose($this->fileHandle); $this->fileHandle = false; // Rename tmp to real name rename(optCACHEPATH . 'tmp.'.$this->cacheName, optCACHEPATH.$this->cacheName); } // Record errors $this->error = curl_error($tmp); // Close cURL curl_close($tmp); }
What version of PHP are you using? If you're unsure, run this and see what you get: <?php echo phpversion(); ?> PHP: If it's 4.x.x, then replace all "public"s (and "private" and "protected", if any) with "var". If it's 5+.. then post your full code.
if it's 4.x.x, then replace all "public"s (and "private" and "protected", if any) with "var" hmm, i think in php 4 that will give an error.
Try this. Should be PHP 4 compatible class cURL { # Debug data # public $cookiesSent = array(); # public $cookies = array(); # public $posted = ''; # End debug var $status = '0'; // HTTP status code var $headers = array(); // Record headers for later use var $error = false; // Hold cURL error var $abort = false; // Our errors / reason for abortion var $return; // Store the return var $proxyOptions = array(); // Store our proxy browsing options var $docType = 0; // Corresponding parser (from content type) var $cacheName; // Name of cache file to save as (false for no cache) var $fileHandle; // Handle for cache file var $length = 0; var $endHeaders = true; // Flag for end of headers, checked in readBody function cURL($toLoad,$curlOptions,$options,$cache) { // Set proxy options $this->proxyOptions = $options; // And cache name $this->cacheName = $cache; # Debug # $this->posted = isset($curlOptions[CURLOPT_POSTFIELDS]) ? $curlOptions[CURLOPT_POSTFIELDS] : ''; # $this->cookiesSent = isset($curlOptions[CURLOPT_COOKIE]) ? $curlOptions[CURLOPT_COOKIE] : array(); # End debug // Set our callbacks $curlOptions[CURLOPT_HEADERFUNCTION] = array(&$this,'readHeaders'); $curlOptions[CURLOPT_WRITEFUNCTION] = array(&$this,'readBody'); // Start curl handle $tmp = curl_init($toLoad); // Set our options if ( function_exists('curl_setopt_array') ) curl_setopt_array($tmp,$curlOptions); else foreach ( $curlOptions as $option => $value ) curl_setopt($tmp,$option,$value); // Get return curl_exec($tmp); // Close file handle if ( $this->fileHandle ) { fclose($this->fileHandle); $this->fileHandle = false; // Rename tmp to real name rename(optCACHEPATH . 'tmp.'.$this->cacheName, optCACHEPATH.$this->cacheName); } // Record errors $this->error = curl_error($tmp); // Close cURL curl_close($tmp); } PHP:
ok...i see that I have three { ......... but only two } so that makes sense. where am i missing the one }??
If people just read the errors: Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in Parse errors only occur when something is in the wrong place or something is missing. As the error above states, you are missing a } in your code, which it was expecting. Trace your code for the error. Peace,
Hi all I am having a similiar problem I keep getting this errorarse error: syntax error, unexpected $end, expecting ')' in /home/multespo/public_html/shops/admin/index.php on line 40 Aany help would be a great help The code is below; <?php /* $Id: index.php,v 1.19 2003/06/27 09:38:31 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2006 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); $cat = array(array('title' => BOX_HEADING_CONFIGURATION, 'image' => 'configuration.gif', 'href' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1'), 'children' => array(array('title' => BOX_CONFIGURATION_MYSTORE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=1')), array('title' => BOX_CONFIGURATION_LOGGING, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=10')), array('title' => BOX_CONFIGURATION_CACHE, 'link' => tep_href_link(FILENAME_CONFIGURATION, 'selected_box=configuration&gID=11')))), array('title' => BOX_HEADING_MODULES, 'image' => 'modules.gif', 'href' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment'), 'children' => array(array('title' => BOX_MODULES_PAYMENT, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=payment')), array('title' => BOX_MODULES_SHIPPING, 'link' => tep_href_link(FILENAME_MODULES, 'selected_box=modules&set=shipping')))), array('title' => BOX_HEADING_CATALOG, 'image' => 'catalog.gif', 'href' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'), 'children' => array(array('title' => CATALOG_CONTENTS, 'link' => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog')), array('title' => BOX_CATALOG_MANUFACTURERS, 'link' => tep_href_link(FILENAME_MANUFACTURERS, 'selected_box=catalog')))), array('title' => BOX_HEADING_LOCATION_AND_TAXES, 'image' => 'location.gif', 'href' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes'), 'children' => array(array('title' => BOX_TAXES_COUNTRIES, 'link' => tep_href_link(FILENAME_COUNTRIES, 'selected_box=taxes')), array('title' => BOX_TAXES_GEO_ZONES, 'link' => tep_href_link(FILENAME_GEO_ZONES, 'selected_box=taxes')))), array('title' => BOX_HEADING_CUSTOMERS, 'image' => 'customers.gif', 'href' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'), 'children' => array(array('title' => BOX_CUSTOMERS_CUSTOMERS, 'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers')),
I have had it downloaded for a while now and it keeps coming up with different parse errors.I fix one line of code and than the error moves to another line.