@@ -7,31 +7,31 @@ class Curl {
77 private $ _headers = array ();
88 private $ _options = array ();
99
10- private $ _multi_parent = FALSE ;
11- private $ _multi_child = FALSE ;
12- private $ _before_send = NULL ;
13- private $ _success = NULL ;
14- private $ _error = NULL ;
15- private $ _complete = NULL ;
10+ private $ _multi_parent = false ;
11+ private $ _multi_child = false ;
12+ private $ _before_send = null ;
13+ private $ _success = null ;
14+ private $ _error = null ;
15+ private $ _complete = null ;
1616
1717 public $ curl ;
1818 public $ curls ;
1919
20- public $ error = FALSE ;
20+ public $ error = false ;
2121 public $ error_code = 0 ;
22- public $ error_message = NULL ;
22+ public $ error_message = null ;
2323
24- public $ curl_error = FALSE ;
24+ public $ curl_error = false ;
2525 public $ curl_error_code = 0 ;
26- public $ curl_error_message = NULL ;
26+ public $ curl_error_message = null ;
2727
28- public $ http_error = FALSE ;
28+ public $ http_error = false ;
2929 public $ http_status_code = 0 ;
30- public $ http_error_message = NULL ;
30+ public $ http_error_message = null ;
3131
32- public $ request_headers = NULL ;
33- public $ response_headers = NULL ;
34- public $ response = NULL ;
32+ public $ request_headers = null ;
33+ public $ response_headers = null ;
34+ public $ response = null ;
3535
3636 public function __construct () {
3737 if (!extension_loaded ('curl ' )) {
@@ -40,23 +40,23 @@ public function __construct() {
4040
4141 $ this ->curl = curl_init ();
4242 $ this ->setUserAgent (self ::USER_AGENT );
43- $ this ->setOpt (CURLINFO_HEADER_OUT , TRUE );
44- $ this ->setOpt (CURLOPT_HEADER , TRUE );
45- $ this ->setOpt (CURLOPT_RETURNTRANSFER , TRUE );
43+ $ this ->setOpt (CURLINFO_HEADER_OUT , true );
44+ $ this ->setOpt (CURLOPT_HEADER , true );
45+ $ this ->setOpt (CURLOPT_RETURNTRANSFER , true );
4646 }
4747
4848 public function get ($ url_mixed , $ data =array ()) {
4949 if (is_array ($ url_mixed )) {
5050 $ curl_multi = curl_multi_init ();
51- $ this ->_multi_parent = TRUE ;
51+ $ this ->_multi_parent = true ;
5252
5353 $ this ->curls = array ();
5454
5555 foreach ($ url_mixed as $ url ) {
5656 $ curl = new Curl ();
57- $ curl ->_multi_child = TRUE ;
57+ $ curl ->_multi_child = true ;
5858 $ curl ->setOpt (CURLOPT_URL , $ this ->_buildURL ($ url , $ data ), $ curl ->curl );
59- $ curl ->setOpt (CURLOPT_HTTPGET , TRUE );
59+ $ curl ->setOpt (CURLOPT_HTTPGET , true );
6060 $ this ->_call ($ this ->_before_send , $ curl );
6161 $ this ->curls [] = $ curl ;
6262
@@ -83,14 +83,14 @@ public function get($url_mixed, $data=array()) {
8383 }
8484 else {
8585 $ this ->setopt (CURLOPT_URL , $ this ->_buildURL ($ url_mixed , $ data ));
86- $ this ->setopt (CURLOPT_HTTPGET , TRUE );
86+ $ this ->setopt (CURLOPT_HTTPGET , true );
8787 return $ this ->_exec ();
8888 }
8989 }
9090
9191 public function post ($ url , $ data =array ()) {
9292 $ this ->setOpt (CURLOPT_URL , $ this ->_buildURL ($ url ));
93- $ this ->setOpt (CURLOPT_POST , TRUE );
93+ $ this ->setOpt (CURLOPT_POST , true );
9494 $ this ->setOpt (CURLOPT_POSTFIELDS , $ this ->_postfields ($ data ));
9595 return $ this ->_exec ();
9696 }
@@ -138,13 +138,13 @@ public function setCookie($key, $value) {
138138 $ this ->setOpt (CURLOPT_COOKIE , http_build_query ($ this ->_cookies , '' , '; ' ));
139139 }
140140
141- public function setOpt ($ option , $ value , $ _ch =NULL ) {
141+ public function setOpt ($ option , $ value , $ _ch =null ) {
142142 $ ch = is_null ($ _ch ) ? $ this ->curl : $ _ch ;
143143 $ this ->_options [$ option ] = $ value ;
144144 return curl_setopt ($ ch , $ option , $ value );
145145 }
146146
147- public function verbose ($ on =TRUE ) {
147+ public function verbose ($ on =true ) {
148148 $ this ->setOpt (CURLOPT_VERBOSE , $ on );
149149 }
150150
@@ -198,7 +198,7 @@ private function _postfields($data) {
198198 return $ data ;
199199 }
200200
201- protected function _exec ($ _ch =NULL ) {
201+ protected function _exec ($ _ch =null ) {
202202 $ ch = is_null ($ _ch ) ? $ this : $ _ch ;
203203
204204 if ($ ch ->_multi_child ) {
@@ -216,14 +216,14 @@ protected function _exec($_ch=NULL) {
216216 $ ch ->error = $ ch ->curl_error || $ ch ->http_error ;
217217 $ ch ->error_code = $ ch ->error ? ($ ch ->curl_error ? $ ch ->curl_error_code : $ ch ->http_status_code ) : 0 ;
218218
219- $ ch ->request_headers = preg_split ('/\r\n/ ' , curl_getinfo ($ ch ->curl , CURLINFO_HEADER_OUT ), NULL , PREG_SPLIT_NO_EMPTY );
219+ $ ch ->request_headers = preg_split ('/\r\n/ ' , curl_getinfo ($ ch ->curl , CURLINFO_HEADER_OUT ), null , PREG_SPLIT_NO_EMPTY );
220220 $ ch ->response_headers = '' ;
221- if (!(strpos ($ ch ->response , "\r\n\r\n" ) === FALSE )) {
221+ if (!(strpos ($ ch ->response , "\r\n\r\n" ) === false )) {
222222 list ($ response_header , $ ch ->response ) = explode ("\r\n\r\n" , $ ch ->response , 2 );
223223 if ($ response_header === 'HTTP/1.1 100 Continue ' ) {
224224 list ($ response_header , $ ch ->response ) = explode ("\r\n\r\n" , $ ch ->response , 2 );
225225 }
226- $ ch ->response_headers = preg_split ('/\r\n/ ' , $ response_header , NULL , PREG_SPLIT_NO_EMPTY );
226+ $ ch ->response_headers = preg_split ('/\r\n/ ' , $ response_header , null , PREG_SPLIT_NO_EMPTY );
227227 }
228228
229229 $ ch ->http_error_message = $ ch ->error ? (isset ($ ch ->response_headers ['0 ' ]) ? $ ch ->response_headers ['0 ' ] : '' ) : '' ;
@@ -260,13 +260,13 @@ function is_array_assoc($array) {
260260
261261function is_array_multidim ($ array ) {
262262 if (!is_array ($ array )) {
263- return FALSE ;
263+ return false ;
264264 }
265265
266266 return !(count ($ array ) === count ($ array , COUNT_RECURSIVE ));
267267}
268268
269- function http_build_multi_query ($ data , $ key =NULL ) {
269+ function http_build_multi_query ($ data , $ key =null ) {
270270 $ query = array ();
271271
272272 if (empty ($ data )) {
0 commit comments