Home Cloud Account Management Support Forums Downloads About Us  

Blue Alligator Support Forums

Support for the Blue Alligator applications

You are not logged in.

#1 2014-01-07 11:07:10

art
Junior member
Registered: 2012-04-25

Incomplete Web Service response

Hi I wrote a php script to upload data to web service. Everything is working fine files which I am sending are one Cloud server, but response from yours server looks incomplete this is example of my code:

this is function which I am using to upload data

Code:

function cloud_upload($url,$upl_data){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POST,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $upl_data);
    curl_setopt($ch, CURLOPT_HEADER, false);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
    $response = curl_exec($ch);
    $status = curl_getinfo($ch);

    curl_close ($ch);

    
    return $response;
}

this is how I call function

Code:

$x = cloud_upload($url,$cloud);
$json = json_encode($x);
echo "var_dump result<br/>";
var_dump($json);
echo "<br/><br/>print_r result<br/>";
print_r($json);

and results which I get

Code:

var_dump result
string(111) ""0<\/code>Upload file ok<\/message><\/result>""

print_r result
"0<\/code>Upload file ok<\/message><\/result>"

It's look that

Code:

<result> and <code> is missing.

Question is am I doing something wrong or this response is incomplete.

Offline

 

#2 2014-01-07 15:05:32

admin
Administrator
Registered: 2008-02-09

Re: Incomplete Web Service response

The full response you're getting in this instance is:

<result><code>0</code><message>Upload file ok</message></result>

However, it looks like the opening element names are being removed at your end (including the "message" name, possibly by the $json_encode call. what was the value of $x?) so you're left with

0</code>Upload file ok</message></result>

Offline

 

#3 2014-01-07 20:53:39

art
Junior member
Registered: 2012-04-25

Re: Incomplete Web Service response

Code:

 echo $x;

or

Code:

 print_r($x);

gives me

Code:

0Upload file ok

I am not able to get clean xml respond like you have in yours examples, maybe it's cURL fault

Last edited by art (2014-01-07 20:54:28)

Offline

 

#4 2014-01-08 10:13:10

admin
Administrator
Registered: 2008-02-09

Re: Incomplete Web Service response

It may be the fault of "cURL", we are not familiar with it.

If the response was only missing the beginning and/or end then it would indicate that it was incomplete, but in your instance "<message>" is also missing from the middle of the response which indicates to us that it's being altered in some way after it has been received.

Offline

 

Board footer

Apple, the Apple logo, iPod, iPod touch, iPad and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries. iPhone is a trademark of Apple Inc. App Store is a service mark of Apple Inc.
© Copyright 2009 - Blue Alligator Company Limited. All rights reserved.