Skip to content

Commit 677b02e

Browse files
committed
Penambahan fitur
1 parent 3115b1c commit 677b02e

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

application/libraries/Http_req.php

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class Http_req {
2828

2929
private static $body = NULL;
3030

31-
private static $method = 'GET';
32-
3331
protected function get_curl_method($method) {
3432

3533
$curlauth = $this->config->item('curlauth');
@@ -338,6 +336,69 @@ public function set_JsonOpt($isassoc = FALSE, $rekusi = 512, $options = JSON_NUM
338336

339337
} // end set_JsonOpt
340338

339+
publicf function set_Proxy($ip, $port = 1080, $tunneling = FALSE, $type = CURLPROXY_HTTP) {
340+
341+
if ($port != 1080) {
342+
343+
Unirest\Request::proxy($ip, $port, $type);
344+
345+
} else if ($tunneling) {
346+
347+
Unirest\Request::proxy($ip, $port, $type, TRUE);
348+
349+
} else {
350+
351+
Unirest\Request::proxy($ip);
352+
353+
} // end if else
354+
355+
} // end of set_Proxy
356+
357+
public function curl_options($options) {
358+
359+
if (is_string($options) && strtolower($options) == 'clear') {
360+
361+
Unirest\Request::clearCurlOpts();
362+
363+
} else {
364+
365+
Unirest\Request::curlOpt($options);
366+
367+
} // end if else
368+
369+
} // end curl_options
370+
371+
public function ssl_validation($bool = TRUE) {
372+
373+
Unirest\Request::verifyPeer($bool);
374+
375+
} // end ssl_validation
376+
377+
public function utility($set = 'info') {
378+
379+
switch (strtolower($set)) {
380+
381+
case 'info':
382+
383+
return Unirest\Request::getInfo();
384+
385+
break;
386+
387+
case 'handle':
388+
389+
return Unirest\Request::getCurlHandle();
390+
391+
break;
392+
393+
default:
394+
395+
return Unirest\Request::getInfo();
396+
397+
break;
398+
}
399+
400+
} // end utility
401+
341402
public function get_File($path, $typeread = 'text/plain') {
342403

343404
return Unirest\Request\Body::file($path, $typeread);

0 commit comments

Comments
 (0)