Hi! I'm working on an app that's working with some auth APIs, and I'm hitting a wall with the PHP return function to get the right redirect_uri to match my app's settings.

Code I have right now:

function callbackUrl($type)
{
return BASE_URL . "/install.php?action={$type}Callback";

}

What I end up with in the header is:

http%3A%2F%2Fiarchitectures.com%2FTw2other-master%2Finstall.php%3Faction%3DsinaCallback&response_type=code

Problem is that the site's API won't accept this as a true match for the redirect_uri - since this value for the redirect_uri can't be coded (i.e. http%3A%2F%2F needs to be [url]http://)[/url]

I've been trying to figure out how to have the return no result in this coded url.

Any help would be great! Thanks!

    Welcome to PHPBuilder! A raging redhead should fit in very well :p

    I assume you've tried

    return urldecode(BASE_URL . "/install.php?action={$type}Callback");

    ?

      Unfortunately yes. I've also tried:

      return rawurldecode(BASE_URL . "/install.php?action={$type}Callback");

      and

      return htmlspecialchars_decode(BASE_URL . "/install.php?action={$type}Callback");

      and

      return html_entity_decode(BASE_URL . "/install.php?action={$type}Callback");

        So, somewhere else in the app is doing the encoding.

        Does a "String class" exist? Can you search the app's source code for "urlencode()"? Can you say what app it is? (Not necessary, but might be helpful ... someone 'round here might be familiar with it ...)

          Thanks so much dalecosp! I really appreciate the help.

          I'd done a trawl through for urlencode already (thought it might be an easy fix). I changed every one I found to urldecode. No luck there.

          There isn't a string class that's universal, and it seems that at some points the url building is being done as an array. But where I wonder it could be happening is in some of the parsing. But it's a bit beyond me to be sure what I can hack and change and what I can't.

          The app is Tw2other, and I'm working to connect Twitter to auto-post to Weibo with some personal tweaks - but nothing to this end of things. Original source is here: https://github.com/cluries/Tw2other

            Hi dalecosp. Thanks again for all your help. You got me back up and digging into the class php file, and I managed to track down a spot where I could put a urldecode command which managed to get the output to be decoded:

            return urldecode($this->authorizeURL() . "?" . http_build_query($params));

            I still can't figure out why the URL is being outputted coded in the first place, but it works for now. Thanks for your help and support. Have a great day!

              You're welcome!

              Please consider helping the other folks out by marking this thread as "RESOLVED" using the link under the "Thread Tools" drop-down.

              And have a great W.E.Y.T.I! 🙂

                Write a Reply...