Arjan_IO
Arjan_IO

Reputation: 175

Pushover cURL-code gives error

I have this code:

    curl_setopt_array($ch = curl_init(), array(
    CURLOPT_URL => "https://api.pushover.net/1/messages.json",
    CURLOPT_POSTFIELDS => array(
            "token" => "XXX",
            "user" => "XXX",
            "message" => $msg,
    ),
    CURLOPT_SAFE_UPLOAD => true,
    ));
    curl_exec($ch);
    curl_close($ch);

But is gives me this error:

Array keys must be CURLOPT constants or equivalent integer values in /etc/noiphp/run.php on line 73

Any ideas?

cURL-version info:

curl 7.29.0 (mips-openwrt-linux-gnu) libcurl/7.29.0 OpenSSL/1.0.1h zlib/1.2.7
Protocols: file ftp ftps http https imap imaps pop3 pop3s rtsp smtp smtps tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

Upvotes: 2

Views: 189

Answers (1)

Pedro Lobito
Pedro Lobito

Reputation: 99081

CURLOPT_SAFE_UPLOAD is only supported on PHP >= 5.5.0, remove that option and you should be good to go, also, it wasn't an error, just a warning.

curl_setopt_array($ch = curl_init(), array(
    CURLOPT_URL => "https://api.pushover.net/1/messages.json",
    CURLOPT_POSTFIELDS => array(
            "token" => "XXX",
            "user" => "XXX",
            "message" => $msg,
    )
    ));
curl_exec($ch);
curl_close($ch);

CURLOPT_SAFE_UPLOAD

TRUE to disable support for the @ prefix for uploading files in CURLOPT_POSTFIELDS, which means that values starting with @ can be safely passed as fields. CURLFile may be used for uploads instead.
Added on PHP 5.5.0 with FALSE as the default value. PHP 5.6.0 changes the default value to TRUE.

http://php.net/manual/en/function.curl-setopt.php

Upvotes: 1

Related Questions