PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] Laravel5 Redirect to external URL with params

 February 16, 2022     laravel-4, laravel-5, php     No comments   

Issue

I've gone through the following page, but I can't find any examples at all: http://laravel.com/docs/5.1/responses#redirects.

I've tried the following:

return redirect()->away('http://bla.com');

This works, but as soon as you add params to it you get the following error message

PHP:

return redirect()->away('http://bla.com', ['bla' => 'bla']);

ERROR:

InvalidArgumentException in Response.php line 470: The HTTP status code "1" is not valid.


Solution

Just add them to the string.

return redirect()->away('http://bla.com?bla=bla');

The second parameter for this function is the http status that should be sent to the visitor. So when you add an array this is parsed as a 1.



Answered By - Jerodev
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing