Facebook Error Message: Requires valid next URL.

Let me start with asking you a few questions!

  1. Are you having issues with the Facebook API?
  2. Are you constantly getting the error message “API Error Code: 100 API Error Description: Invalid parameter Error Message: Requires valid next URL.“?
  3. Are you using the latest official Facebook PHP class?
  4. Are you redirecting using the PHP header() function?

Facebook error

Well,  I might have a solution for you. When calling the function getLoginUrl in the Facebook PHP class, the function will return a HTML encoded string. When outputing this string to your browser, it is rendered/decoded by a browser and this will convert all “safe” charachters to their textual equivalent.  This makes that “&” becomes “&” and “%20″ becomes ” “.

However, when using the header() function in PHP, this url will not be rendered/decoded and you are basically sending out a garbled request.

Original

getLoginUrl($params);
header('Location:' . $url);

Solution:

getLoginUrl($params);
$url = str_replace('&','&',urldecode($url));
header('Location:' . $url);

You might also want to look at these posts

  • IPBWI Fatal error: Class ‘ipsCommand’ not found
  • memcache_connect() [function.memcache-connect]: Can’t connect to localhost:11211
  • WordPress mysqli 2.9 Database Class Patch
  • xdebug trace file parser
  • Fun With Fake Facebook Accounts
  • 

    One Response (Add Your Comment)

    1. I got this error message. Sayen took care of the problem, thank you.

    Leave a Reply

    Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Archives

    Twitter!