How do i get facebook share link ignore & character - php

i got a problem here. On my site i have a facebook share button, but it sends a link with some get variables. So im guessing facebook just handles these as $_GET['blabla'] but i want that link to be shared.
Currently the link to be shared is:
http://www.EXAMPLE.com/wptest/?page_id=38&vodid=1&t=152
so the link is:
http://www.facebook.com/sharer/sharer.php?s=100&p[url]=www.EXAMPLE.com/wptest/?page_id=38&vodid=1&t=152
But facebook only shares:
http://www.EXAMPLE.com/wptest/?page_id=38
how to i get my url so facebook (and other sites) treat the whole thing as a link instead of just filling the get array?

What you should do is URL encode the link before going to the sharer.php link, so the link you should use is:
http://www.facebook.com/sharer/sharer.php?s=100&u=http%3A%2F%2Fwww.example.com%2Fwptest%2F%3Fpage_id%3D38%26vodid%3D1%26t%3D152
i.e.
http://www.example.com/wptest/?page_id=38&vodid=1&t=152 becomes http%3A%2F%2Fwww.example.com%2Fwptest%2F%3Fpage_id%3D38%26vodid%3D1%26t%3D152
If you look at the above example, you'll see that the Facebook Sharer page will correctly display the URL in the dialog:

Related

Twitter Sharing URL from personal site is not working as expected

I have a new website, which I've just uploaded my first blog post onto.
I have social sharing buttons on the page, but a few don't seem to work as expected.
In Twitter the URL doesn't appear at all. Its as if its ignored. Here's the twitter link:
https://twitter.com/intent/tweet/?url=http://www.andrewburns.info%2Fblog%2Ffirstsortedvalue+function+in+Qlikview+script.php&via=AndyBurns89
Facebook and Reddit work fine. Google plus cuts off the URL after the first space, even though i used urlencode on the link:
https://plus.google.com/share?url=www.andrewburns.info%2Fblog%2Ffirstsortedvalue+function+in+Qlikview+script.php
I tried posted the link directly into Twitter and it doesn't seem to recognise that its a webpage at all. It doesn't shorten the link down like it normally does.
Have a look at this https://dev.twitter.com/web/tweet-button/web-intent. Take a look at the query parameters and notice the http:%3A%2F%2Fexample.com%2F

URL redirection & Un-Shorten a link via PHP

I'm building a site which has amazon & other affiliates associated with it and I'd like to use the links on twitter, however the links on twitter are shortened using bitly. Is it possible to unshorten the link using php?
So for example, the full url may be:
http://www.mysite.com/unbit.php?url=<a href="https://rads.stackoverflow.com/amzn/click/com/B0049J4O0K" rel="nofollow noreferrer" />
Which will automatically get shortened by twitter.
So what I want to do then is catch the URL (url=...)on my unbit.php page, unshorten it to the full url, log the details in a table and then pass on the user from my website using the unshortened url link.
I hope I understand your question correctly. You can have unbit.php call the bit.ly URL and then get the location of the URL it forwards too. See this example: php get url of redirect from source url
If you don't want to use cURL, try something like this: https://stackoverflow.com/a/12566320/3079918

Efficent url redirection in php

I am using a url redirection technique similar to google
Example
if you type wikipedia in google you get a wikpedia page result but if you click the link it will first go to this kind of redirecting link
http://www.google.com/url?some_paramaeters_for_wikipedia_page_redirection
and then it will go to
http://www.wikipedia.org/
i have made similar algorithm in my website and its working properly;But as in google when you want to copy the link location
it doesnt copy the main web link
http://www.wikipedia.org/
Instead it copies
http://www.google.com/url?some_paramaeters_for_wikipedia_page_redirection
I want to know if it is possible for users to copy the orginal link instead of url redirecting link without changing redirecting method.
Thanks for your info
Yes, what you should do is keep the real link in the href attribute (so the "Copy link location" works),
and with a bit of Javascript, on the click event of your link, replace this real URL with your redirecting one's.

Link to a certain page inside a Facebook Tab application

I'm writing a PHP application that will serve as a Facebook Tab inside of a Page. In the application, the user has the option to Share a photo, be it on Facebook or as a link to put on other websites. The part with Facebook is easy, but my question is this.
How can I give someone a link to a page inside of a Facebook Tab?
For example, the direct url from which the tab loads the website is: http://my-site.com/tab
Inside of that website I have an url that looks like http://my-site.com/tab/photo.php?id=3
The url of the Facebook Tab is something like http://facebook.com/my-page/app_3932734623842
What I want is for the user to be able to paste a link on their twitter which would lead them directly to the page http://my-site.com/tab/photo.php?id=3 inside of the Facebook app.
Possible? How? :(
Thank you!

facebook, how to get to a application page?

i've setup a application that has a path to:
www.some_page.com/index.php
on the page i have a link that goes to:
www.some_page.com/picture.php?number=123
this page displays in the same fb iframe application.
My question is how to get to www.some_page.com/picture.php?number=123 from an outside link?
if i just link to it it will take me to the page but outside the facebook app, and i need t to take me to that page inside the app..
i guess that when i click on that link i have to send the user first to accept the app access then got o that page ?!
any ideas?
Thanks
edit 1:
** what i want is to place a link to www.some_page.com/picture.php?number=123 on another site and redirect me that page inside the facebook app
There are 2 options to set a facebook app:
embed your www.some_page.com inside an iframe (this will make sure all your links will stay inside)
Follow this: http://developers.facebook.com/docs/appsonfacebook/tutorial/ and make sure you don't have target="_blank" this is a better option and your links should open in the same scope.

Categories