Highlight search terms in forum when coming from websearch - search-engine

in the recent past i’ve noticed quite often that, when searching something with google and looking at one of the search results, that the search terms are bold on the site.
how can this be done? is it a feature of google which is messing around with other sites (i hope not!) or are some sites parsing the referrer and check for search engine links and try to hilight the search terms?
i’m curious for the answers

That feature works by looking at the http referer header sent by browser. This post should explain how it work: http://weblogtoolscollection.com/archives/2009/04/10/how-to-highlight-search-terms-with-jquery/

You have to look into http referrer http server variable, there You will find URL where user comes from.

I believe you can look in the HTTP headers for the referrer (i.e. the previous URL visited). If your visitor arrived from Google, that will be the URL of the search page. Sending this header is a feature of most web browsers and it's useful for things like this. As Google search results are GET queries, a standard referrer url looks like:
http://www.google.com/search?q=stack+overflow
You can parse these out to get the query terms and format appropriately using server side script. I'm sure there's a library to do this, but it wouldn't be hard to write one.

after googling around for a while i found a plugin for phpBB.
it can be found in their forums: http://www.phpbb.com/community/viewtopic.php?f=69&t=784615
it will take all popular search engines into account and hilight the search terms in the forum. reading the plugin is a great source of information

Related

Zapier to look up Twitter URL mentions

Is it possible to create a Zap that will look-up URL mentions on Twitter?
Been scratching my head with this one, since simply entering URL into Zapier's Twitter Search field doesn't seem to do the trick.
Is it at all possible? Twitter uses its URL shortening service t.co on all links posted. Might this be a reason for me not being able to find any mentions of my URL even when I post one myself? Twitter's native search function finds URL just fine, but not Zapier.
OK, I think I figured it out.
First, use Twitter's special "url" prefix for URL search:
url:amazon - will find URL with the word “amazon” anywhere within it.
Second, most importantly, it looks like the Twitter account I used for testing got ignored after a couple of same URL posts. So be aware of that too.

Does the Twitter API auto shorten URLs

I know this question has been asked before however the answers I found where a little old and I know that twitter has now made the t.co/xyz service manditory on all posts recently. I'm just wondering if when using the oAuth API service it will automatically shorten any url? Anyone know what the current process in play is? Do I still need to shorten the url pre posting?
Thanks very much
Yes. Even when using OAuth, all links will be wrapped in t.co short URLs. Even if the link is shorter than 20 characters!
See the post in the discussion groups.
There is also some documentation about recent and upcoming changes to t.co shortening (2012-04-12).
You can shorten the URL yourself if you want, but it will still get wrapped.

Is there a URL is can use to search for an image and returns the first found image?

I want to use a URL to search for a car by its name & model and have the first image hit returned. Is there a way to achieve this? I've looked at Google & YAHOO, but they return more than I wish for.
All I need is my request to be redirected to the URL of the first found image....
One way to obtain a relevant imagine (not equal to the top hit on Google), is:
http://( Type any keyword here ).jpg.to
For example:
http://dog.jpg.to
http://biting_dog.jpg.to
http://mercedes_benz.jpg.to
I know you mentioned Yahoo didn't work, however we are utilizing a Yahoo API in a very similar context successfully. Check out the BOSS image search API. One of the reasons we originally went with BOSS was that it does not have any daily limits. The image search API also lets you filter, indicate size, and more. The results are returned in XML.
With all that being said, if we had to do it over, we would go the Bing API route, as Bing has a brighter future than Yahoo and has very similar, if not better, API. It looks like it can return results in XML, JSON, and SOAP.
EDIT:
After seeing you were JUST looking for a URL, I tried all the three major search engines and the following URL was the closest I could come to what you decribed: http://www.bing.com/images/search?q=car&view=detail&first=1
I'm afraid the only way to get exactly what you are looking for 100% client side would to be to utilize the Bing API with a jsonp result and then manipulate the DOM via Javascript. Check out this code sample for a rough start.
Bing has a pretty easy to use web search API. You can pass it a URL with various parameters and it will return an XML result. The two parameters you would be interested in would be SourceType (=Image) and ImageRequest.Count (=1).
However, you would need to parse the XML because it won't just give you back the image data.

How would I find all the short urls that link to a particular long url?

Basically I want to know how many people have tweeted a link to a url, but since there are dozens of link shortener out there I don't see any way to do this without having access to all of their url maps. I found a previous question here but it was over a year old and didn't have any new answers.
So #1, does anyone know of a service/API for doing this?
And #2, can anyone think of a way to accomplish this task other than submitting the long url in question to all the popular link shortening sites?
ps- I'm also open to comments about why this is impossible or impractical.
You could perform a Google search (or the equivalent via API) for any pages that link to your page. This is done with the link: keyword. So if you're trying to figure out how many people link to www.example.com (regardless of whether it's through a link shortner URL), then you would just do a Google search for link:www.example.com.
e.g.: http://www.google.com/search?q=link:www.example.com
Note that this will only find pages that have been indexed, so pages that haven't been crawled, or pages that get crawled infrequently, will not show up in the results until a later date (if at all).
Since all sites have different algorithms for shortening the URLs, and these are different sites that most likely do not share their data with each other, how can you hope to find all of them in a single or small number of queries?
All you can do is brute-force it, and even then this might not be any good if a site is content to create a new value for the same long-form URL (especially if you send a different long-form URL that maps to the same place, like http://www.stackoverflow.com/ rather than http://stackoverflow.com/).
In order to really get this to work, there would have to be a site that ALREADY automatically collects all of this information from every site, which the URL shortening sites voluntarily call. And even if you wrote such a site, that doesn't account for the URL-shortening sites already out there who already have data!
In short, I do not see how this is remotely possible, unless I'm wrong about there being such a database somewhere out there.
So months after asking this question I came across a solution to a similar question, that is how to tell how many times a link has been shared on facebook. The solution, via a simple new API call:
http://graph.facebook.com/http://stackoverflow.com
returns the following json data:
{
"id": "http://stackoverflow.com",
"shares": 1627
}

Google sees something that it shouldn't see. Why?

For some mysterious reason, Google has indexed both these adresses, that lead to the same page:
/something/some-text-1055.html
and
/index.php?pg=something&id=1055
(short notice - the site has had friendly urls since its launch, I have no idea how google found the "index.php?" url - there are "unfriendly" urls only in the content management system, which is password-restricted)
What can I do to solve the situation? (I have around 1000 pages that are double-indexed.) Somebody told me to use "disallow: index.php?" in the robots.txt file.
Right or wrong? Any other suggestions?
You'd be surprised as how pervasive and quick the google bots are at indexing site content. That, combined with lots of CMS systems creating unintended pages/links making it likely that at some point those links were exposed is the most likely culprit. It's also possible your administration area isn't as secure as you think, the google bot got through that way.
The well-behaved, and google recommended, things to do here are
If possible, create 301 redirects from you query string style URLs to your canonical style URLs. That's you saying "hey there, web bot/browser, the content that used to be at this URL is now at this other URL"
Block the query string content in your robots.txt. That's like asking the spiders or other automated programs "Hey, please don't look at this stuff. These aren't the URLs you're looking for"
Google apparently allows you to specify a canonical URL now via a <link /> tag in the top of your page. Consider adding these in.
As to whether doing the well behaved things is the the "right" thing to do re: Google rankings ... who knows. Only "Google" knows how their algorithms work now, and will work in the future, and by Google, I mean a bunch of engineers and executives with conflicting goals on how search should work.
Google now offers a way to specify a page's canonical URL. You can use the following code in your HTML to tell Google your canonical URL:
<link rel="canonical" href="http://www.example.com/product.php?item=swedish-fish" />
You can read more about canonical URLs on Google on their blog post on the subject, here: http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
According to the blog post, Ask.com, Microsoft Live Search and Yahoo! all support the canonical tag.
If you use sitemap generators to submit to search engines, you'll want to disallow in them as well. They are likely where Google got your links, from crawling your folder and from checking your logs.
Better check what URI has been requested ($_SERVER['REQUEST_URI']) and redirect if it was /index.php.
Changing robots.txt will not help, since the page is already indexed.
The best is to use a permanent redirect (301).
If you want to remove a page once indexed by Google the only way, more or less, is to make it return a 404 not found message.
Is it possible you're posting a form to a similar url and google is simply picking it up from the source?

Resources