Skip to main content

Posts

Showing posts from 2013

PHP

PHP HEADER CAN ONLY BE CALLED ONCE I hate spending too much time just trying to solve one little problem. This was seriously one of those times. To give some background on what I was trying to do, I needed to have a user log into one system and have it automatically authenticate against another site on the same server. Your usual "single sign-on" functionality. The problem was, I didn't want to duplicate a lot of code to encode session data as this app was doing. Instead, I made a request to the login form from the server, passing in the credentials and grabbing the response. Then, I'd pass the Set-Cookie headers back to the client. Voila! Okay, not quite. First, it turns out that you can't use  header  more than once for the same header. It's even  documented . Fine, I missed that. Then I needed to break down each of the Set-Cookie headers and recreate them as PHP  setcookie  calls. Lastly, it didn't like that I wasn't setting a path. That mea...