I'm using php json_encode function before send to client and library
PHP_APE
Var_dump result :
array
  0 => string 'Hello  APE' (length=10)

object(stdClass)[6]
  public 'time' => string '1287334533' (length=10)
  public 'raw' => string 'ERR' (length=3)
  public 'data' =>
    object(stdClass)[7]
      public 'code' => string '005' (length=3)
      public 'value' => string 'BAD_JSON' (length=8)

------------------------------------------------------------------------------------
Example message :

$message = array('Hello  APE');
Function getJsonString :

function getJsonString(){
                return json_encode(array($this->getRequestData()));
        }
-----------------------------------------------------------------------------------------------------
$ch = curl_init();
                $rawData = $request->getJsonString();
                if($ch){
                $headers = array();
                $header[] = "Accept: text/xml,application/xml,application/
xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
                $header[] = "Accept-Language: en-us,en;q=0.5";
                $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
                        curl_setopt($ch, CURLOPT_POST, 1 );
                        curl_setopt($ch, CURLOPT_POSTFIELDS,$rawData);
                    curl_setopt($ch, CURLOPT_URL, $this->getUrl()); // set url 
to
post to
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                    curl_setopt($ch, CURLOPT_ENCODING,"");
                    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,10);
                    curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 0);
                    $data = curl_exec($ch);
                    $results=false;
                    if (!curl_errno($ch)) {
                            $results = $data;
                    } else {
                            throw new ApeException('CURL ERROR 
'.print_r(curl_error($ch),
1));
                    }
                    curl_close($ch);
                    return $results;
-----------------------------------------------------------------------------
It work with message not contain space. Ex : HelloAPE

Help me fix this bug, thanks !

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to