Parse error: syntax error, unexpected T_OBJECT_OPERATOR

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Post by michaelh613 »

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in line 89

I am just in the process of learning OOP PHP 5.

The error is in the foreach. I am probably doing something wrong with the start. It works when I write is procedurally. I'm sure this is a
syntax issue

Related issue is when should I use $this->variable and just $variable in a method.

Code: Select all

 
public function sendTransaction()
{
        
//Note below is lin 89  
    foreach(this->$authnet_values as $key => $value ) 
    $this->fields .= "$key=" . urlencode( $value ) . "&";
    $this->ch = curl_init($this->auth_net_url); 
    curl_setopt($this->ch, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
    curl_setopt($this->ch, CURLOPT_POSTFIELDS, rtrim( $this->fields, "& " )); // use HTTP POST to send form data
    ### curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ###
    $this->resp = curl_exec($this->ch); //execute post and get results
    curl_close ($this->ch); 
}
 
 
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Post by michaelh613 »

Figued it out thanks
Post Reply