2016-05-02 3 views
2

У меня есть этот код:Pushover Curl-код дает ошибку

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); 

Но это дает мне эту ошибку:

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

Любые идеи?

Curl-версия Информация:

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 

ответ

1

CURLOPT_SAFE_UPLOAD поддерживается только на PHP >= 5.5.0, удалить эту опцию, и вы должны быть хорошо идти, кроме того, он не был error, просто 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

Смежные вопросы