Google Blogoscoped

Wednesday, March 2, 2005

PHP5 and Yahoo API Problems

I'm running into problems using the Yahoo API with PHP5, and I'd appreciate your help; the line throwing the error (Warning: parser error : Unknown encoding "utf-8") is marked below:

<?

header("Content-type: text/html; charset=utf-8");

$q = ( isset($_GET['q']) ) ? $_GET['q'] : 'google';

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Yahoo API Test</title>
</head>
<body>

<?
showImages($q);
?>

</body>
</html><?

function showImages($q)
{
    $image_url = 'http://api.search.yahoo.com/ImageSearchService/V1/imageSearch?' .
            'appid=YahooDemo&query=' . urlencode($q) . '&results=5';
    $dom = new domdocument;

    echo '<a href="' . $image_url . '">' . $image_url . '</a>';

    $dom->load($image_url); // Error
    $xpath = new domxpath($dom);

    $xNodes = $xpath->query('//Result');
    foreach ($xNodes as $xNode)
    {
        $title = $xpath->query('Title', $xNode)->item(0)->firstChild->data;
        echo $title . '<br />';
    }
}

?>

Google and Firefox

According to ZDnet, Google is giving money to the Mozilla foundation, but in return requests local builds of Firefox to feature Google as the default browser search engine (even when one might find other search engines are more popular or relevant in a particular country). [Via IG.]

Update: Luke Baker points to an interesting post from the Mozillazine which says this is not true. Now who’s right? Here are the two opposing takes on the issue:

Asa says:

“There are a few big misrepresentations here. The first is around the localized releases and the suggestion that we’ve got some contractual obligation to include the Google, Yahoo, Amazon, eBay and other web services and search engine even where it doesn’t make sense. This is totally bogus. Not only are we not contractualy obliged (...)”

ZDnet quotes Mozilla staff member Gervase Markham as having said:

“That [the Google deal] is why official localised builds are not allowed to change the search engine,” said Markham. “In one way this is a restriction, but the deal has allowed things to happen.”

So possibly, all this is just a misunderstanding.

Google Hacks Video

Rael Dornfest, co-author of “Google Hacks”, is presenting some hacks at the Screen Savers TV show. Many more interesting videos (on topics such as Fark, Slashdot, podcasting, or virtual communities) are available at the site.

Blogging on German TV Part II

The first time blogging was covered on German TV, German blogspace at large was quite unhappy with the polemic results*. Now NDR gives it a second try, and at least the Spreeblick blog is optimistic. The NDR show is airing Wednesday, 2005-03-09 23:00:00.

*By the way, last time I recorded the show on Sat1 and put a short “video quote” in my post, but after some days the production company contacted me and asked me to remove the video. And so I did, because I’m unsure of the copyright issues involved here – e.g., was my usage fair use, and whether or not Germans even have such a concept as fair use.

GSuggest Firefox Search

GSuggest is a neat “Google Suggest"-style Firefox search extension. (Scroll down on that page and choose “Install GoogleSuggest search plugin-in”.) [Via Gadgetopia.]

OS Sucks-Rules-O-Meter

The Operating System Sucks-Rules-O-Meter determines how cool or uncool an OS is based on automated web search surveys. According to the site, Linux is both the best and worst, whereas Windows is just bad (and Amiga does fairly well).

Shortest Google Page

Here is the shortest stand-alone HTML page – which works on at least Firefox and IE6 – I could write to re-create a working Google:

<form action=http://gogle.com/search><input name=q>

That's right, there's no head or body tag, the URL is gogle.com, the input has no text-type, the form tag isn't closed, and this probably won't validate in a million years – yet this works perfectly as HTML page. If you can find an even shorter way to recreate the Google core functionality (less than 51 characters), let me know.

Update: Jan Piotrowski finds this shorter version (which will not show snippets on result pages):

<form action=http://gogle.com/ie><input name=q>

Update 2: Johan Terpstra and Luca Zappa in the forum suggest "google.it":

<form action=http://gogle.it/ie><input name=q>

Update 3: More from Jan Piotrowski in the forum – at 44 letters now:

<form action=http://cb3.de/ie><input name=q>

Update 4: Scott Moonen found an even shorter way, and this will only work from the web server – here's a sample page:

<form action=//cb3.de/ie><input name=q>

Porsche Cayman S in Google

I checked how the new Porsche Cayman car ranks in Google. The official Porsche site is in the second spot in Google.com for both “Porsche Cayman” and “Porsche Cayman S”. The first result is a page at Carpages.co.uk. The third result points to a post at Jalopnik, a popular Gawker Media car blog.

If you however misspell “Cayman”, like “Caynan” or “Caymam”, a spammer will inhibit the first and only rank: top-hotel-discounts.com, with a lot of hidden keywords containing popular misspellings. The following will be the snippet in Google, and while you can’t find this content on the actual page, it is available in the Google Cache:

“car porsche rentals uk : discounts travel world ... caymam disneylaned hoteles dayman frand dis neyland disnehland pavkage graqnd disnweyland psckage islxand trand”

10 Years Yahoo

Yahoo turns 10 today, and they are giving away free ice cream (if you happen to live in the supported regions). [Via Waxy.]

Google Honors Raskin

The Google main page below the footer today reads “In memoriam, Jef Raskin 1943-2005”, with the words Jef Raskin linked. [Thanks Ades in the forum.]

Yahoo Web API Released

The Yahoo! Search Web Services have been released.

“Yahoo! Search Web Services allow you to access Yahoo content and services in your favorite programming languages. This means you can now build Yahoo directly into your own applications.”

Wow. Better than screen-scraping. And they’re even using REST, a sort of pragmatic SOAP.

Yahoo says, “Our Web Services are available for non-commercial use unless you first obtain written permission from Yahoo! If you’re interested in commercial use of our APIs, Please contact yws-non-free@yahoo-inc.com for more information.”

And here’s the SDK.

Yahoo Promotion Network?

Is Yahoo testing their own Google AdSense style framework? Competition would sure be good for webmasters, who could now base their choice of AdSense vs Yahoo framework based on revenues. Andy Baio writes:

“So, I think I have a scoop. I’ve discovered that Yahoo is very quietly testing their new contextual advertising program for blogs and other small publishers, a la Google Adsense. (...)

The Javascript that generates the ad IFrame is hosted on Overture’s server. The domain name refers to “ypn,” which might be an acronym for the ad program... Yahoo Publishing Network, maybe?”

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!