How to get the ID from a Google+ vanity URL - google-plus

How to get the ID from a vanity URL, e. g.?
https://plus.google.com/u/0/s/tesla%20roadster
There are many posts about how to get the vanity URL but not the opposite.

The URl you posted is actually a search not a vanity URL. A vanity url looks like this https://plus.google.com/+TeslaMotors.
But to get the ID from a vanity URL, you can make a request to people.get API method with the +Name as the userId. Here is an example request.

Related

Is there a way to get the url the client was on when a request was sent

I'm trying to get the url of the page a client was on when requestion the manifest.appcache file.
I tried
var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
but i get the url of the file requested when I do that (localhost:1337/manifest.appcache)
What I want is something like localhost:1337/mushroom/
or localhost:1337/gingerbread/ ie the page that the user was on when the request was sent
The Referer HTTP request is what you are looking for.
Instead of using req.originalURL, use req.get('referer')
From MDN web docs: (link)
The Referer request header contains the address of the previous web page from which a link to the currently requested page was followed. The Referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.
I use this on my sites to redirect users back to the page they were on after they login.
Happy coding!

URL to use for Authorised redirect URLs

What is the URL to use for Authorised redirect URLs in Google's OAuth2 API? I've tried many variations, but they all come back with: Error: redirect_uri_mismatch.
The error mentions the following URL not configured:
https://myowndomain.com/myapp/hybrid-auth/endpoint?hauth.done=Google
In the API console, I have configured these URLs at one point:
https://myowndomain.com/myapp/hybrid-auth/endpoint
https://myowndomain.com/myapp/hybrid-auth
Do I have to configure the whole URL, even the querystring? Or, perhaps this is a result of my website not accepting what Google is sending?
Edit #1
I get further now that I added the entire URL:
https://myowndomain.com/myapp/hybrid-auth/endpoint?hauth.done=Google
The configured redirect URL and the requested redirect URL must be a character-for-character match. I've never seen a URL with a query string before. Maybe it works, or maybe that's the problem. If you need to pass state through the dance, look at the state= parameter.

How to hide part of a URL from clients using htaccess?

I'm working on a website running on an Apache server. The PHP factory makes and takes URLs that look like this:
site.com/page/view/[id]/[vanity-url]
However, the client wants to hide part of the URL from view, so in the browser it appears as:
site.com/[vanity-url]
The server still needs to see the full URL.
I've tried various RewriteRules after hours of searching, and the closest I seem to have come is:
RewriteRule ^page/view/(.*)/(.*)$ /$2 [R,L]
...but that doesn't seem to be doing anything. I know for sure that my .htacces is working.
What am I doing wrong?
Unfortunately, this isn't possible. Let me explain why:
You state that the server needs to see the full URL. Specifically, this includes the id segment, which I am sure your framework needs (it wouln't need it if the server only needs to see the vanity segment). The code you have provided redirects the full URL to the vanity URL, thus making the full URL invisible to the server for the next request.
So, navigating to /page/view/2/about-us would redirect to /about-us, and the address bar would change to reflect that. This causes a new request to be sent to the server, containing only the /about-us vanity URL.
As a result, you would need to rewrite the vanity URL back to the full URL (without redirecting, so that the /about-us stays in the address bar as-is), but you wouldn't be able to do this, as the vanity URL does not contain the id segment, which seems to be a requirement for the framework to serve the correct response. Keep in mind that Apache cannot guess the ID for that particular vanity URL.

Flattr API Call for Discoverable URLs

Do you know how to do an API Call for Discoverable URLs? Can I just do something like:
http://flattr.com/submit/auto?url='PUT_URL_HERE'
without any aditional data like user_id etc.?
There is a endpoint in the Flattr API to lookup information about a URL. The endpoint is https://api.flattr.com/rest/v2/things/lookup. You do a GET request with a added url parameter containing the URL you want to know more about.
Example:
Request>
GET /rest/v2/things/lookup?url=http://smgt.me
Response>
HTTP/1.1 302 Redirect
Location: https://api.flattr.com/rest/v2/things/435836
{"message":"found","location":"https:\/\/api.flattr.com\/rest\/v2\/things\/435836"}
In the lookup resource you can also find information about autosubmit URL. More information about lookup resource in the dev docs. If you on the otherhand want to try to Flattr a URL (both a regular URL and a autosubmit URL) you can have a look at the flattr resource docs. More information about autosubmit URLs is also available over at the developer docs.

Using a shortener service doesn't count as a backlink for Google?

Is it preferable to use bit.ly or a URL like http://www.dummy.com/?p=1234 for the purpose of SERP?
Is anybody knows?
Thanks!
bit.ly uses HTTP 301 redirects which are ok for google (some people call it "they pass value"). so if you need shortened URLs you can use bit.ly. but they just "pass value" to the target URL (the url you originally shortened). the original url will show up in the SERPs, not the redirect (short) URL.