PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 1.2.6
JetFormBuilder — Dynamic Blocks Form Builder v1.2.6
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / classes / curl-helper.php
jetformbuilder / includes / classes Last commit date
attributes-trait.php 4 years ago condition-helper.php 4 years ago curl-helper.php 4 years ago factory.php 4 years ago gallery.php 4 years ago get-icon-trait.php 4 years ago get-template-trait.php 4 years ago instance-trait.php 4 years ago listing-filter-manager.php 4 years ago listing-filter.php 4 years ago messages-helper-trait.php 4 years ago tools.php 4 years ago
curl-helper.php
74 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Classes;
5
6
7 class Curl_Helper {
8
9 public $curl;
10 public $url;
11 public $fields = array();
12 public $result;
13 public $options = array();
14 public $headers = array();
15
16
17 public function __construct( $url ) {
18 $this->curl = curl_init();
19 $this->url = $url;
20 }
21
22 public function add_header( $name, $value ) {
23 $this->headers[] = "$name:$value";
24 }
25
26 public function set_headers( $headers ) {
27 foreach ( $headers as $name => $value ) {
28 $this->add_header( $name, $value );
29 }
30 }
31
32 public function set_post_fields( $fields ) {
33 if ( $fields ) {
34 $this->options[ CURLOPT_POSTFIELDS ] = $fields;
35 }
36
37 return $this;
38 }
39
40 public function set_auth( $auth ) {
41 $this->options[ CURLOPT_USERNAME ] = $auth;
42
43 return $this;
44 }
45
46 private function set_options() {
47 $this->options += array(
48 CURLOPT_URL => $this->url,
49 CURLOPT_RETURNTRANSFER => true,
50 CURLOPT_TIMEOUT => 10,
51 );
52 }
53
54 public function set_post( $is_post = true ) {
55 if ( $is_post ) {
56 $this->options[ CURLOPT_POST ] = $is_post;
57 }
58
59 return $this;
60 }
61
62 public function execute() {
63 $this->set_options();
64
65 curl_setopt_array( $this->curl, $this->options );
66 curl_setopt( $this->curl, CURLOPT_HTTPHEADER, $this->headers );
67
68 $this->result = curl_exec( $this->curl );
69
70 return $this->result;
71 }
72
73 }
74