PluginProbe ʕ •ᴥ•ʔ
Limit Login Attempts Security – Login Security, 2FA, Firewall, Brute Force Prevention / 3.2.4
Limit Login Attempts Security – Login Security, 2FA, Firewall, Brute Force Prevention v3.2.4
3.2.4 3.2.3 3.2.2 3.2.1 3.2.0 trunk 2.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.14.0 2.15.0 2.15.1 2.15.2 2.16.0 2.17.0 2.17.1 2.17.2 2.17.3 2.17.4 2.18.0 2.19.0 2.19.1 2.19.2 2.2.0 2.20.0 2.20.1 2.20.2 2.20.3 2.20.4 2.20.5 2.20.6 2.21.0 2.21.1 2.22.0 2.22.1 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.25.0 2.25.1 2.25.10 2.25.11 2.25.12 2.25.13 2.25.14 2.25.15 2.25.16 2.25.17 2.25.18 2.25.19 2.25.2 2.25.20 2.25.21 2.25.22 2.25.23 2.25.24 2.25.25 2.25.26 2.25.27 2.25.28 2.25.29 2.25.3 2.25.4 2.25.5 2.25.6 2.25.7 2.25.8 2.25.9 2.26.0 2.26.1 2.26.10 2.26.11 2.26.12 2.26.13 2.26.14 2.26.15 2.26.16 2.26.17 2.26.18 2.26.19 2.26.2 2.26.20 2.26.21 2.26.22 2.26.23 2.26.24 2.26.25 2.26.26 2.26.27 2.26.28 2.26.3 2.26.4 2.26.5 2.26.6 2.26.7 2.26.8 2.26.9 2.3.0 2.4.0 2.5.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.8.0 2.8.1 2.9.0 3.0.0 3.0.1 3.0.2 3.1.0
limit-login-attempts-reloaded / core / http / HttpTransportFopen.php
limit-login-attempts-reloaded / core / http Last commit date
Http.php 2 weeks ago HttpTransportCurl.php 2 weeks ago HttpTransportFopen.php 2 weeks ago HttpTransportInterface.php 2 weeks ago HttpTransportWp.php 2 weeks ago
HttpTransportFopen.php
95 lines
1 <?php
2
3 namespace LLAR\Core\Http;
4
5 class HttpTransportFopen implements HttpTransportInterface {
6
7 /**
8 * @param $url
9 * @param array $options
10 *
11 * @return array
12 */
13 public function get( $url, $options = array() ) {
14
15 if( !empty( $options['data'] ) ) {
16 $query_str = http_build_query( $options['data'] );
17 $url .= "?{$query_str}";
18 }
19
20 $headers = !empty( $options['headers'] ) ? $options['headers'] : array();
21
22 return $this->request( $url, 'GET', $headers );
23 }
24
25 /**
26 * @param $url
27 * @param array $options
28 *
29 * @return array
30 */
31 public function post( $url, $options = array() ) {
32
33 $headers = !empty( $options['headers'] ) ? $options['headers'] : array();
34 $data = !empty( $options['data'] ) ? $options['data'] : array();
35
36 return $this->request( $url, 'POST', $headers, $data );
37 }
38
39 /**
40 * @param $url
41 * @param $method
42 * @param array $headers
43 * @param array $data
44 *
45 * @return array
46 */
47 private function request( $url, $method, $headers = array(), $data = array() ) {
48
49 $method = strtoupper( trim( $method ) );
50
51 $request_data = null;
52 if( !empty( $data ) ) {
53 $request_data = json_encode( $data, JSON_FORCE_OBJECT );
54 }
55
56 $context = stream_context_create( array(
57 'http' => array(
58 'method' => $method,
59 'header' => implode( "\r\n", $headers ),
60 'content' => $request_data
61 )
62 ));
63
64 $fp = @fopen( $url, 'rb', false, $context );
65
66 $error = null;
67 $status = null;
68 $response = null;
69
70 if ( !$fp ) {
71
72 if( !empty( $http_response_header[0] ) ) {
73 list(, $code, $message ) = explode( ' ', $http_response_header[0], 3 );
74 $error = $message;
75 $status = $code;
76
77 } else {
78 $last_err = error_get_last();
79 $error = !empty( $last_err['message'] ) ? $last_err['message'] : 'Unknown error!';
80 }
81
82 } else {
83 list(, $code ) = explode( ' ', $http_response_header[0], 3 );
84 $status = $code;
85
86 $response = stream_get_contents( $fp );
87 }
88
89 return array(
90 'data' => $response,
91 'status' => intval( $status ),
92 'error' => $error
93 );
94 }
95 }