I'm trying to create a function to turn a link into a link to 'add link to Pocket' via getpocket.com/save.
I don't want to use the API and have users have to start logging in to their Pocket account - the /save link works if they're already logged in on the current browser.
I have:
function save_pocket($url){
$enc = rawurlencode($url);
$pocket = "http://getpocket.com/save/?url=";
return $pocket.$enc;
}
save_pocket()
is then called in <a href="
.
But this returns either $url
or $enc
, I can't tell which. But the issue is it's not adding $pocket
prefix.
Why?
Thanks for the responses, in the end it boiled down to me just being an idiot.
I was using a function which echo
'd the url to pass urls into my function.
Swapped that for one that just presents url as a string, and it works like a champ.
Thanks again for tolerating my idiocy...