wordpress - Laravel response returns protected data -
i have 2 applications,
first 1 built using laravel , second 1 built using wordpress.
i'm trying download file first app. here's api route in laravel :
route::get("/lp/downloadall", function(){ $headers = ['content-type' => 'application/zip']; return response()->download('lp/archives/file-1.zip', 'file-1.zip', $headers); });
and here's code within wordpress :
$url = 'http://localhost:8000/api/lp/downloadall'; $args = array(); $response = wp_remote_get( $url, $args ); $response_headers = wp_remote_retrieve_headers( $response );
when printed out response object using print_r function , here how looked :
requests_utility_caseinsensitivedictionary object ( [data:protected] => array ( [host] => localhost:8000 [x-powered-by] => php/5.6.11 [content-type] => application/zip [cache-control] => public [date] => fri, 28 jul 2017 00:42:39 gmt [last-modified] => sun, 23 jul 2017 18:23:20 gmt [content-disposition] => attachment; filename="file-1.zip" [content-length] => 63131 [accept-ranges] => bytes [x-ratelimit-limit] => 60 [x-ratelimit-remaining] => 59 ) )
i cannot data attribute because it's protected, i'm trying filename later on can write response body file , give name.
Comments
Post a Comment