Plugin Directory

Changeset 1840290


Ignore:
Timestamp:
03/14/2018 08:09:09 PM (8 years ago)
Author:
recomendo
Message:

fixed client

Location:
recomendo
Files:
1 added
1 edited
14 copied

Legend:

Unmodified
Added
Removed
  • recomendo/trunk/recomendo-client.php

    r1839675 r1840290  
    77
    88    const DATE_TIME_FORMAT = DateTime::ISO8601;
    9     const TIMEOUT = 2;
     9    const TIMEOUT = 3;
     10    const HTTPVERSION = '1.1';
     11
    1012
    1113    function __construct() {
     14
    1215        $options = get_option( 'recomendo_api' );
    1316        $this->username = $options['username'];
     
    1619        $this->eventserver_url = $options['eventserver_url'];
    1720        $this->api_access_key = $options['api_access_key'];
     21        $this->recomendo_version = '0.9.3';
     22
     23        global $wp_version;
     24        $this->user_agent = 'WordPress/' . $wp_version . ' - ' .
     25                            'Recomendo/' . $this->recomendo_version;
     26
    1827    }
    1928
     
    2130        return array(
    2231                'Content-Type' => 'application/json',
     32                'User-Agent' =>  $this->user_agent,
    2333                'Authorization' => 'Basic ' . base64_encode( $this->username . ':' . $this->password )
    2434        );
     
    4757                        array(
    4858                          'timeout' => self::TIMEOUT,
     59                          'httpversion' => self::HTTPVERSION,
    4960                          'headers' => $this->get_header(),
    5061                          'body' => json_encode( $query ),
     
    7889                        array(
    7990                          'timeout' => self::TIMEOUT,
     91                          'httpversion' => self::HTTPVERSION,
    8092                          'headers' => $this->get_header(),
    8193                          'body' => json_encode([
     
    118130                        array(
    119131                          'timeout' => self::TIMEOUT,
     132                          'httpversion' => self::HTTPVERSION,
    120133                          'headers' => $this->get_header(),
    121134                          'body' => json_encode([
     
    151164                        array(
    152165                          'timeout' => self::TIMEOUT,
     166                          'httpversion' => self::HTTPVERSION,
    153167                          'headers' => $this->get_header(),
    154168                          'body' => json_encode([
     
    184198                        array(
    185199                          'timeout' => self::TIMEOUT,
     200                          'httpversion' => self::HTTPVERSION,
    186201                          'headers' => $this->get_header(),
    187202                          'body' => json_encode([
     
    220235                        array(
    221236                          'timeout' => self::TIMEOUT,
     237                          'httpversion' => self::HTTPVERSION,
    222238                          'headers' => $this->get_header(),
    223239                          'body' => json_encode([
     
    252268                        array(
    253269                          'timeout' => self::TIMEOUT,
     270                          'httpversion' => self::HTTPVERSION,
    254271                          'headers' => $this->get_header(),
    255272                          'body' => json_encode([
     
    292309                        array(
    293310                          'timeout' => self::TIMEOUT,
     311                          'httpversion' => self::HTTPVERSION,
    294312                          'headers' => $this->get_header(),
    295313                          'body' => json_encode([
     
    323341                        array(
    324342                          'timeout' => self::TIMEOUT,
     343                          'httpversion' => self::HTTPVERSION,
    325344                          'headers' => $this->get_header(),
    326345                          'body' => json_encode($data)
     
    346365                        array(
    347366                          'timeout' => self::TIMEOUT,
     367                          'httpversion' => self::HTTPVERSION,
    348368                          'headers' => $this->get_header()
    349369                        )
     
    365385                      array(
    366386                        'timeout' => self::TIMEOUT,
     387                        'httpversion' => self::HTTPVERSION,
    367388                        'headers' => $this->get_header(),
    368389                        'body' => json_encode([
     
    387408                      array(
    388409                        'timeout' => self::TIMEOUT,
     410                        'httpversion' => self::HTTPVERSION,
    389411                        'headers' => $this->get_header(),
    390412                        'body' => json_encode([
Note: See TracChangeset for help on using the changeset viewer.