cURL classes 


curl apg

The cURL classes.



<?php

array get_declared_classes();

?>

  


This function has no parameters.



  1 EXERCISE   

<?php

// Run this exercise and see the classes listed below

$arr=get_declared_classes();

echo 
'<pre>';

print_r($arr);

echo 
'</pre>';

?>

 RESULT   

Array
(
.
.
.
[154] => CurlHandle
[155] => CurlMultiHandle
[156] => CurlShareHandle
[157] => CURLFile
[158] => CURLStringFile
.
.
.
)

  The CurlHandle class   


  The CurlHandle class    

A fully opaque class which replaces curl resources as of PHP 8.0.0.


<?php

final class CurlHandle {
}

?>

  The CurlMultiHandle class   


  The CurlMultiHandle class    

A fully opaque class which replaces curl_multi resources as of PHP 8.0.0.


<?php

final class CurlMultiHandle {
}

?>

  The CurlShareHandle class   


  The CurlShareHandle class    

A fully opaque class which replaces curl_share resources as of PHP 8.0.0.


<?php

final class CurlShareHandle {
}

?>

  The CURLFile class   


  The CURLFile class   

Unserialization of CURLFile instances is not allowed.

As of PHP 7.4.0, serialization is forbidden in the first place.

This class or CURLStringFile should be used to upload a file with CURLOPT_POSTFIELDS.


<?php

class CURLFile {
/* Properties */
public string $name "";
public 
string $mime "";
public 
string $postname "";
/* Methods */
public __construct(string $filename, ?string $mime_type null, ?string $posted_filename null)
public 
getFilename(): string
public getMimeType(): string
public getPostFilename(): string
public setMimeType(string $mime_type): void
public setPostFilename(string $posted_filename): void
}

?>


name
Name of the file to be uploaded.

mime
MIME type of the file
(default is application/octet-stream).

postname
The name of the file in the upload data
(defaults to the name property).

  The CURLStringFile class   


  The CURLStringFile class   

makes it possible to upload a file directly from a variable. This is similar to CURLFile, but works with the contents of the file, not filename.

This class or CURLStringFile should be used to upload a file with CURLOPT_POSTFIELDS.


<?php

class CURLStringFile {
/* Properties */
public string $data;
public 
string $postname;
public 
string $mime;
/* Methods */
public __construct(string $datastring $postnamestring $mime "application/octet-stream")
}

?>


data
The content to be uploaded.

postname
The name of the file to be used in the upload data.

mime
MIME type of the file 
(default is application/octet-stream).