dimanche 12 novembre 2017

Laravel file_get_contents requires login

I need a server-side solution to authenticate PHP file_get_contents to access another route from another action in my Laravel application.

I have JobController and finalize action, from finalize action:

public function finalize(Request $request,Job $job, $ok = false)
    {

        dd(file_get_contents(url('/operation/get-production/'.$job->id)));

The /operation/get-production/'.$job->id URL outputs a JSON object, but the current situation leads to redirection to the login form, so file_get_contents acts as another client. I have seen another client-side solutions that depends on sending user name and password using cURL but I dislike this solution. Is there any other solution rather than dedicating some user and password and allow me to deal with the URL with file get contents?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zQ0VgJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire