@@ -264,41 +264,6 @@ public function delete($url, $query_parameters = array(), $data = array())
264
264
return $ this ->exec ();
265
265
}
266
266
267
- /**
268
- * Download Complete
269
- *
270
- * @access private
271
- * @param $fh
272
- */
273
- private function downloadComplete ($ fh )
274
- {
275
- if (!$ this ->error && $ this ->downloadCompleteFunction ) {
276
- rewind ($ fh );
277
- $ this ->call ($ this ->downloadCompleteFunction , $ fh );
278
- $ this ->downloadCompleteFunction = null ;
279
- }
280
-
281
- if (is_resource ($ fh )) {
282
- fclose ($ fh );
283
- }
284
-
285
- // Fix "PHP Notice: Use of undefined constant STDOUT" when reading the
286
- // PHP script from stdin. Using null causes "Warning: curl_setopt():
287
- // supplied argument is not a valid File-Handle resource".
288
- if (!defined ('STDOUT ' )) {
289
- define ('STDOUT ' , fopen ('php://stdout ' , 'w ' ));
290
- }
291
-
292
- // Reset CURLOPT_FILE with STDOUT to avoid: "curl_exec(): CURLOPT_FILE
293
- // resource has gone away, resetting to default".
294
- $ this ->setOpt (CURLOPT_FILE , STDOUT );
295
-
296
- // Reset CURLOPT_RETURNTRANSFER to tell cURL to return subsequent
297
- // responses as the return value of curl_exec(). Without this,
298
- // curl_exec() will revert to returning boolean values.
299
- $ this ->setOpt (CURLOPT_RETURNTRANSFER , true );
300
- }
301
-
302
267
/**
303
268
* Download
304
269
*
@@ -503,25 +468,6 @@ public function head($url, $data = array())
503
468
return $ this ->exec ();
504
469
}
505
470
506
- /**
507
- * Create Header Callback
508
- *
509
- * @access private
510
- * @param $header_callback_data
511
- *
512
- * @return callable
513
- */
514
- private function createHeaderCallback ($ header_callback_data )
515
- {
516
- return function ($ ch , $ header ) use ($ header_callback_data ) {
517
- if (preg_match ('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi ' , $ header , $ cookie ) === 1 ) {
518
- $ header_callback_data ->responseCookies [$ cookie [1 ]] = trim ($ cookie [2 ], " \n\r\t\0\x0B" );
519
- }
520
- $ header_callback_data ->rawResponseHeaders .= $ header ;
521
- return strlen ($ header );
522
- };
523
- }
524
-
525
471
/**
526
472
* Options
527
473
*
@@ -1080,7 +1026,7 @@ public function setTimeout($seconds)
1080
1026
public function setUrl ($ url , $ mixed_data = '' )
1081
1027
{
1082
1028
$ this ->baseUrl = $ url ;
1083
- $ this ->url = $ this ->buildURL ($ url , $ mixed_data );
1029
+ $ this ->url = $ this ->buildUrl ($ url , $ mixed_data );
1084
1030
$ this ->setOpt (CURLOPT_URL , $ this ->url );
1085
1031
}
1086
1032
@@ -1238,7 +1184,7 @@ private function buildCookies()
1238
1184
*
1239
1185
* @return string
1240
1186
*/
1241
- private function buildURL ($ url , $ mixed_data = '' )
1187
+ private function buildUrl ($ url , $ mixed_data = '' )
1242
1188
{
1243
1189
$ query_string = '' ;
1244
1190
if (!empty ($ mixed_data )) {
@@ -1251,6 +1197,60 @@ private function buildURL($url, $mixed_data = '')
1251
1197
return $ url . $ query_string ;
1252
1198
}
1253
1199
1200
+ /**
1201
+ * Create Header Callback
1202
+ *
1203
+ * @access private
1204
+ * @param $header_callback_data
1205
+ *
1206
+ * @return callable
1207
+ */
1208
+ private function createHeaderCallback ($ header_callback_data )
1209
+ {
1210
+ return function ($ ch , $ header ) use ($ header_callback_data ) {
1211
+ if (preg_match ('/^Set-Cookie:\s*([^=]+)=([^;]+)/mi ' , $ header , $ cookie ) === 1 ) {
1212
+ $ header_callback_data ->responseCookies [$ cookie [1 ]] = trim ($ cookie [2 ], " \n\r\t\0\x0B" );
1213
+ }
1214
+ $ header_callback_data ->rawResponseHeaders .= $ header ;
1215
+ return strlen ($ header );
1216
+ };
1217
+ }
1218
+
1219
+ /**
1220
+ * Download Complete
1221
+ *
1222
+ * @access private
1223
+ * @param $fh
1224
+ */
1225
+ private function downloadComplete ($ fh )
1226
+ {
1227
+ if (!$ this ->error && $ this ->downloadCompleteFunction ) {
1228
+ rewind ($ fh );
1229
+ $ this ->call ($ this ->downloadCompleteFunction , $ fh );
1230
+ $ this ->downloadCompleteFunction = null ;
1231
+ }
1232
+
1233
+ if (is_resource ($ fh )) {
1234
+ fclose ($ fh );
1235
+ }
1236
+
1237
+ // Fix "PHP Notice: Use of undefined constant STDOUT" when reading the
1238
+ // PHP script from stdin. Using null causes "Warning: curl_setopt():
1239
+ // supplied argument is not a valid File-Handle resource".
1240
+ if (!defined ('STDOUT ' )) {
1241
+ define ('STDOUT ' , fopen ('php://stdout ' , 'w ' ));
1242
+ }
1243
+
1244
+ // Reset CURLOPT_FILE with STDOUT to avoid: "curl_exec(): CURLOPT_FILE
1245
+ // resource has gone away, resetting to default".
1246
+ $ this ->setOpt (CURLOPT_FILE , STDOUT );
1247
+
1248
+ // Reset CURLOPT_RETURNTRANSFER to tell cURL to return subsequent
1249
+ // responses as the return value of curl_exec(). Without this,
1250
+ // curl_exec() will revert to returning boolean values.
1251
+ $ this ->setOpt (CURLOPT_RETURNTRANSFER , true );
1252
+ }
1253
+
1254
1254
/**
1255
1255
* Parse Headers
1256
1256
*
0 commit comments