I have a file_get_contents($myUrl)
call from a flat PHP script that isn't working.
If I run $myUrl
in a browser it works fine, if I do it over the file_get_contents()
it behaves as if the url is incorrect or incomplete.
The myUrl looks like this
https://login.myApp.com/getWifiSettings/ofBoSf593f
Where the last part is a token, and the sym2 webApp behaves as if that token is incorrect, the same way as if I were to paste everything but the last character in the browser (thus producing an incorrect token).
I don't know whether this is an issue caused by the file_get_contents() (do I need any parameters with it to work?) or if it is some security setting in my sym2 installation that denies access for such a call (how does it distinguish between a user's web browser calling the route and a script using file_get_contents to access the route?)
Try to us trim() on the string before you submit it to file_get_contents. It may be that a whitespace character is in the variable and is being submitted and interpreted as part of the URL.