开发者

How to get normalized url with Janrain openid library?

I'm trying to implement openId for my site and am using Janrain's library with php. I want to check if openId user provided is already stored in database. I want to compare only normalized uri's to avoid situation when user 开发者_如何学JAVAsometimes doesn't type in "http://..." etc. Now, I'm having trouble finding out specific function that can normalize uri for me right after user enters openId, so as soon as it hits my server, before anything is being send to openId provider. btw as you can imagine slowly I am getting fed up with trying to get all this working, but still willing to give it a try so any help would be much appreciated.


(Assuming you mean Janrain's "OpenID Enabled" PHP5 library, v 2.2.2 or thereabouts.) There is Auth_OpenID::normalizeUrl($url) defined in OpenID.php, however it is marked as @access private. Initiating an authorization transaction will get you a normalized URL as a result of the process, but that's not really what you are looking for. You could ignore the private access, hack the library to make it public, and then just keep your patch implemented as you upgrade versions (if they ever release one). Alternatively, you could just look at what they're doing and copy it out to a function of your own, avoiding any library hacks and the associated version control issues.


If you use something like:

$url = str_replace(array("http://", "https://", "www."), "", $url);

That should help you get the same URL each time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜