471,624 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

Yahoo API + PHP5: "Unknown encoding utf-8"?

I want to try the new Yahoo API, but I get the PHP5 error message

Unknown encoding "utf-8"

in the marked line below...
(After that, applying the Xpath will fail as symptom of the first bug.)

function showImages($q)
{

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

$dom = new domdocument; // ERROR!

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

$xNodes = $xpath->query('//Result');
foreach ($xNodes as $xNode)
{
// ...
}
}
Can anyone help? I tried some encoding workarounds but nothing
worked... note my direct file access with PHP5 is disabled on my server
(using file() or fopen()).

--
Google Blogoscoped
http://blog.outer-court.com
Jul 17 '05 #1
3 2782
Philipp Lenssen wrote:
I want to try the new Yahoo API, but I get the PHP5 error message

Unknown encoding "utf-8"

<snip>

This is not an answer to your question. FWIW, I did look at the SDK
<http://developer.yahoo.net/download/download.html> and the PHP code
written by Rasmus Lerdorf. I have the *humble opinion* that this code
could have been written better--with better standard and style.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #2
R. Rajesh Jeba Anbiah wrote:
Philipp Lenssen wrote:
I want to try the new Yahoo API, but I get the PHP5 error message

Unknown encoding "utf-8"

<snip>

This is not an answer to your question. FWIW, I did look at the SDK
<http://developer.yahoo.net/download/download.html> and the PHP code
written by Rasmus Lerdorf. I have the *humble opinion* that this code
could have been written better--with better standard and style.


You might be right. I just posted something in my blog on that today:
http://blog.outer-court.com/archive/2005-03-03-n69.html

I wish there'd be a working PHP5 sample using the more modern native
DOM/XML classes.
Jul 17 '05 #3
Philipp Lenssen wrote:
Philipp Lenssen wrote:
I want to try the new Yahoo API, but I get the PHP5 error message

Unknown encoding "utf-8"

<snip>


Update; I sort of solved it, with a hack:
http://blog.outer-court.com/archive/2005-03-04-html#n49
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Colin McGuigan | last post: by
8 posts views Thread by Demon News | last post: by
2 posts views Thread by J Huntley Palmer | last post: by
2 posts views Thread by John | last post: by
reply views Thread by R | last post: by
reply views Thread by cty | last post: by
6 posts views Thread by working_boy | last post: by
15 posts views Thread by maya | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.