php - How to return just JSON response from Laravel 4 REST API? -


i have laravel restful api setup needs return data in json format app on 1 of subdomains ( , not within laravel app ).

in rest returning like:

return \response::json(array(     "status"  => "success",     "type"    => "client",     "message" => "nothing see here!" )); 

in class on subdomain app trying return response view print output testing.

i hope json, when simple:

echo $resp; 

i nothing

if a:

print_r( $resp ); 

or

json_decode( $resp ); 

i get:

http/1.1 200 ok server: nginx/1.6.2 content-type: application/json transfer-encoding: chunked connection: keep-alive x-powered-by: php/5.4.35 access-control-allow-origin: * cache-control: no-cache date: sat, 06 dec 2014 04:18:15 gmt set-cookie: laravel_session=eyjpdii6ik5dddfgk2tjq3zcvkjpqnrtzhrau2c9psisinzhbhvlijoit2txstjwyzrkuxzncg9nofzbykhoutzraug1c3nmuxlhtjf5bzyyatzryuy4s3vbmedwdjdwdxnunhkwblppv1i5yufsy2dodgnyrhh5smzyegfjcwc9psisim1hyyi6ijc0mzg3mgnlntbiyteynte3mznhzdvjnjuznzmwnzk0ztmwn2mwymfindiymge0n2myntqxmdnlmddiogfmotqifq%3d%3d; expires=sat, 06-dec-2014 06:18:15 gmt; path=/; httponly  {"status":"success","type":"client","message":"nothing see here!"} 

i don't want of headers stuff in response that. or receiving , trying parse incorrectly. doing wrong here?

ok, dumb mistake not rest api, curl call api.

if ever happens check , make sure not have:

curl_setopt($ch, curlopt_header, 1); 

that output headers response , mess day. hope helps others.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -