Open gnadelwartz opened 4 years ago
OK found the Problem, UrlShortner needs to first geht the oAuth key, so I have to add it there also:
public function getAccessToken()
{
$client = new Client( [
'base_uri' => 'https://api-ssl.bitly.com/oauth/access_token',
'curl' => [
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5_HOSTNAME,
CURLOPT_PROXY => 'localhost'
],
]);
$response = $client->post(null, [
'auth' => [
$this->username,
$this->password,
],
]);
return $response->getBody()->getContents();
}
Even I found a solution to my Problem, it would be nice to add the possibility to set cUrl options globaly for all modules if needed.
Hi @gnadelwartz ,
Yes you're right, we could pass options in construct as the provider. Could you open a PR in this way please?
even it may not look like, I'm a noob in php programing :)
I can write simple php scripts and copy solutions from stack overflow or find simple fixes, but if it comes to real php incl. OO I have to give up.
I'm more a Shell hacker from stone age
Hello mremi,
I must use UrlShortner with socks5 for some reasons. Unfortunately the typical shell hackers solution using
proxychains shorten ...
does not work with php compiled against glibc.The solution for my own calls to cURL is to provide some cURL options:
unfortunately - for me - you are using guzzle so I can't set CURLOPT direct, but luckly guzzle privides the possiblilty to pass cURL options
As UrlShortner is working with user and password on my server, I tried to add the the socks5 options to your bitly provider for shortening, but it has ho effect:
Are I'm doing something fundamentally worng or did I miss something?
Any other ideas?