Lukeidiot Posted January 27, 2014 Share Posted January 27, 2014 Hello fine people, I have a question today. Here is my code: My question is: How do I pass this function(image below) into my static variable? I tried CURLOPT_PROXY => self::getProxy(), But this didn't work. Any ideas? Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted January 27, 2014 Solution Share Posted January 27, 2014 (edited) You can't do it like that. You have to use a separate line of code to do an assignment. You need to use those options at some point, right? Use the $CURL_OPTIONS as a template and then provide the specific information (ie, the CURLOPT_PROXY value) at runtime. $options = self::$CURL_OPTIONS; $options[CURLOPT_PROXY] = $this->getProxy(); Edited January 27, 2014 by requinix Quote Link to comment Share on other sites More sharing options...
Lukeidiot Posted January 27, 2014 Author Share Posted January 27, 2014 (edited) You can't do it like that. You have to use a separate line of code to do an assignment. You need to use those options at some point, right? Use the $CURL_OPTIONS as a template and then provide the specific information (ie, the CURLOPT_PROXY value) at runtime. $options = self::$CURL_OPTIONS; $options[CURLOPT_PROXY] = $this->getProxy(); What's the best way to add those options to this: I ask because when I assign the options, its also in array (making $options[CURLOPT_PROXY] = $this->getProxy(); throw an error because of the parenthesis) Edited January 27, 2014 by Lukeidiot Quote Link to comment Share on other sites More sharing options...
kicken Posted January 27, 2014 Share Posted January 27, 2014 You use the same format as your other options. CURLOPT_PROXY => $this->getProxy() That or add the $options[CURLOPT_PROXY] = $this->getProxy(); on the next line by itself. Quote Link to comment Share on other sites More sharing options...
Lukeidiot Posted January 27, 2014 Author Share Posted January 27, 2014 You use the same format as your other options. CURLOPT_PROXY => $this->getProxy() That or add the $options[CURLOPT_PROXY] = $this->getProxy(); on the next line by itself. Ah yeah! Works perfectly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.