bored

A micro PHP framework
git clone git://git.bitsmanent.org/bored
Log | Files | Refs | README

commit 304f885d3e6e73e0779ba3bacdd6de7bc659dee2
parent 717827f8fa9a9a02f7c1ded4fdb935dc8f022ae6
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Thu,  6 Sep 2018 14:29:54 +0200

Use $curlopts instead of curl_setopt()

Diffstat:
Mbored.php | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/bored.php b/bored.php @@ -480,17 +480,12 @@ function humanstime($timestamp, $fmts = null) { function curl_post($uri, $curlopts = []) { $c = curl_init(); - curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($c, CURLOPT_URL, $uri); - curl_setopt($c, CURLOPT_POST, true); - - if($curlopts) - foreach($curlopts as $k => $v) - curl_setopt($c, $k, $v); - + $curlopts[CURLOPT_RETURNTRANSFER] = 1; + $curlopts[CURLOPT_URL] = $uri; + $curlopts[CURLOPT_POST] = 1; + curl_setopt_array($c, $curlopts); $ret = curl_exec($c); curl_close($c); - return $ret; }