note 125681 added to function.curl-init
| From: | webmaster at jamescobban dot net | Date: | Fri, 15 Jan 2021 01:07:04 +0000 |
| Subject: | note 125681 added to function.curl-init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216160@lists.php.net to get a copy of this message | ||
On recent distributions CURL and PHP support for CURL have not been included in the main product.
In particular in recent distributions of Ubuntu Linux CURL and PHP support for CURL are not even
available from the official repositories. The steps to incorporate support are complex and require
adding a non-standard repository. It is therefore advisable for programmers to rewrite code to use
the stream interface to access resources across the Internet. For example:
```php
$opts = array(
'http' => array (
'method'=>"POST",
'header'=>
"Accept-language: en\r\n".
"Content-type: application/x-www-form-urlencoded\r\n",
'content'=>http_build_query(array('foo'=>'bar'))
)
);
$context = stream_context_create($opts);
$fp = fopen('https://www.example.com',
'r', false, $context);
```
This stream support can also be accessed using the object-oriented interface of SplFileObject.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.166 (proxied: 216.240.13.50)
----
Manual Page -- http://php.net/manual/en/function.curl-init.php
Edit -- https://master.php.net/note/edit/125681
Del: integrated -- https://master.php.net/note/delete/125681/integrated
Del: useless -- https://master.php.net/note/delete/125681/useless
Del: bad code -- https://master.php.net/note/delete/125681/bad+code
Del: spam -- https://master.php.net/note/delete/125681/spam
Del: non-english -- https://master.php.net/note/delete/125681/non-english
Del: in docs -- https://master.php.net/note/delete/125681/in+docs
Del: other reasons-- https://master.php.net/note/delete/125681
Reject -- https://master.php.net/note/reject/125681
Search -- https://master.php.net/manage/user-notes.php