问题
Trying to use the Request class to get an external resources, but can't figure out how to set more default curl options.
I get the data like this:
$data = Request::factory($url)->execute()->body();
I figured adding CURL options was a simple matter of making a copy of system/config/curl.php
into my application config folder and then setting the options there (I assume they will be merged?).
But those options don't seem to be used at all? Tried to do a var_dump
in Kohana_Request_Client_Curl
after all the options should've been set, but I can only find the ones set directly there in that method, which makes sense as I can't seem to find anywhere these options are actually fetched from the config file...
What am I doing wrong here?
回答1:
Here is more detailed example:
$request = Request::factory($some_url);
$request->client()->options(array(
CURLOPT_SSL_VERIFYPEER => FALSE
));
回答2:
The Request_Curl class doesn't look at that config file. You'll have to use ->options()
manually to set the curl params.
来源:https://stackoverflow.com/questions/10774976/how-to-set-curl-options-when-using-kohana-request