mirror of
https://github.com/metowolf/Meting.git
synced 2026-09-03 07:27:07 +08:00
🍒 Support Proxy (#55)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Meting music framework
|
||||
* https://i-meto.com
|
||||
* https://github.com/metowolf/Meting
|
||||
* Version 1.5.3.
|
||||
* Version 1.5.4.
|
||||
*
|
||||
* Copyright 2018, METO Sheel <i@i-meto.com>
|
||||
* Released under the MIT license
|
||||
@@ -13,7 +13,7 @@ namespace Metowolf;
|
||||
|
||||
class Meting
|
||||
{
|
||||
const VERSION = '1.5.3';
|
||||
const VERSION = '1.5.4';
|
||||
|
||||
public $raw;
|
||||
public $data;
|
||||
@@ -22,6 +22,7 @@ class Meting
|
||||
public $status;
|
||||
|
||||
public $server;
|
||||
public $proxy = null;
|
||||
public $format = false;
|
||||
public $header;
|
||||
|
||||
@@ -53,6 +54,13 @@ class Meting
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function proxy($value)
|
||||
{
|
||||
$this->proxy = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function exec($api)
|
||||
{
|
||||
if (isset($api['encode'])) {
|
||||
@@ -102,6 +110,9 @@ class Meting
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
|
||||
if ($this->proxy) {
|
||||
curl_setopt($curl, CURLOPT_PROXY, $this->proxy);
|
||||
}
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$this->raw = curl_exec($curl);
|
||||
$this->info = curl_getinfo($curl);
|
||||
|
||||
Reference in New Issue
Block a user