src/Scottymeuk/Pushover/Client.php
public function push($user)
    {
        if (! isset($this->data['message'])) {
            throw new Exception('You must supply a message');
        }

        // Fields to send
        $data = array_merge(
            $this->data,
            array(
                'user' => $user,
            )
        );

        // Send data to API
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $this->api_url);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $result = json_decode(curl_exec($curl), true);
        curl_close($curl);

        return isset($result['status']) && (int) $result['status'] === 1;
    }
public function push($user)
    {
        if (! isset($this->data['message'])) {
            throw new Exception('You must supply a message');
        }

        // Fields to send
        $data = array_merge(
            $this->data,
            array(
                'user' => $user,
            )
        );

        // Send data to API
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $this->api_url);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        $result = json_decode(curl_exec($curl), true);
        curl_close($curl);

        return isset($result['status']) && (int) $result['status'] === 1;
    }
public function push ( $ user ) { if ( ! isset ( $ this -> data [ 'message' ] ) ) { throw new Exception ( 'You must supply a message' ) ; } // Fields to send $ data = array_merge ( $ this -> data , array ( 'user' => $ user , ) ) ; // Send data to API $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ this -> api_url ) ; curl_setopt ( $ curl , CURLOPT_POST , true ) ; curl_setopt ( $ curl , CURLOPT_POSTFIELDS , $ data ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , true ) ; $ result = json_decode ( curl_exec ( $ curl ) , true ) ; curl_close ( $ curl ) ; return isset ( $ result [ 'status' ] ) && ( int ) $ result [ 'status' ] === 1 ; }
Push a notification to a specific user
@param  string $user The user token
@return bool       Did the notification send or not?
Push a notification to a specific user