Page 1 of 1

Problem with Curl password

Posted: Sun Mar 16, 2008 1:39 pm
by michaelh613
The error I receive is

Parse error*: syntax error, unexpected ':' in xxx\xxx\xx on line *120*

line 120 is

Code: Select all

curl_setopt($ch, CURLOPT_USERPWD, $this->$user:$this->$password);
I have also tried this hard coding in the uid and password and verified I receive the same error.

Documentation seems to support this usage

It appears to be correct

curl::option CurlHandle,"USERPWD","verhas:m23kkdUT"

Pass a string as parameter, which should be username:password to use for the connection. If the password is left out, you will be prompted for it.

http://www.scriptbasic.com/html/texi/mo ... _3.23.html

Any help will be appreciated.

Re: Problem with Curl password

Posted: Sun Mar 16, 2008 1:50 pm
by scriptah
Hello,

Code: Select all

 
curl_setopt($ch, CURLOPT_USERPWD, $this->$user:$this->$password );
 
You didn't wrap the red section with quotes, so the interpreter is interpreting them literally and not as a string.

Which means, it's interpreting the operator ':' (Paamaym Nekudotaim ).
You should do:

Code: Select all

 
curl_setopt($ch, CURLOPT_USERPWD, "{$this->$user}:{$this->$password}");
 

Re: Problem with Curl password

Posted: Sun Mar 16, 2008 3:15 pm
by michaelh613
scriptah wrote:Hello,

Code: Select all

 
curl_setopt($ch, CURLOPT_USERPWD, $this->$user:$this->$password );
 
You didn't wrap the red section with quotes, so the interpreter is interpreting them literally and not as a string.

Which means, it's interpreting the operator ':' (Paamaym Nekudotaim ).
You should do:

Code: Select all

 
curl_setopt($ch, CURLOPT_USERPWD, "{$this->$user}:{$this->$password}");
 

Thanks