Elio Chamy
Elio Chamy

Reputation: 269

Laravel send data via request to another project

I have a laravel api controller where I'm getting data from a table.

public function moveData() {
    $movelivesales = DB::table('st_sales_live')->get();
    return $movelivesales;
}

I'm getting all the data, now how can I send this data to another project api(this api is ready) using request ? Any help please?

Upvotes: 1

Views: 1936

Answers (1)

Onix
Onix

Reputation: 2179

Just create a route like this to get your data($movelivesales):

Route::get('/your/path', 'YourController@moveData');

Then if you access: http://yourdomain.com/your/path you will get a json of your data

You can get the data from api with php: file_get_contents('http://yourdomain.com/your/path');

Upvotes: 1

Related Questions