“Why does Guzzle put an underscore in my url!?”

This was an issue I agonized over for more time than I’m willing to admit. I was parsing URLs out of an Apache access log to gather real world usage to run against my test server for the day job. I was having the issue when I read the URL from the file and passed the URL to Guzzle that Guzzle would append an underscore to every URL, causing it to 404.

The problem is that I wasn’t trimming the whitespace from the URL and Guzzle turns whitespace into underscores. I really hope someone who ends up searching the same thing finds this so it helps them not spend hours chasing this down.

Today I learned, and I feel dumb because it took me so long to realize.