7

curl_setopt_array( $ch, $curl_opt );

This code gives a Notice Notice: Array to string conversion in ...

This is what $curl_opt contains:

array (size=5)
  42 => boolean true
  19913 => boolean true
  10018 => string 'PHP RestClient/0.1.2' (length=20)
  10005 => 
    array (size=1)
      0 => string 'user:password' (length=13)
  10002 => string 'http://longurl.com/' (length=389)

is_array($curl_opt) returns true, so I don't really know what's causing the notice.

I think I'm just missing something really simple here but I just cannot, for the life of me, figure this one out.

It's just a notice and doesn't break anything but it just annoys me that I don't know what's causing it.

1
  • Can you post some code ? Commented Apr 14, 2014 at 5:27

1 Answer 1

9

$curl_opt should be a one-dimensional array................................

The key 10005 is not that case, it should be

$curl_opt = array(
  //...
  CURLOPT_USERPWD => '[username]:[password]'
  //...
);
Sign up to request clarification or add additional context in comments.

1 Comment

I did not know this. Thank you. This solves my problem. Will accept as answer as soon as it allows me to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.