fopen GB2312 encoding problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sadie

    fopen GB2312 encoding problem

    Hi,

    I am trying to read in a url which is encoded in GB2312 (http://
    top.baidu.com/winkvane.html). I have tried other pages with this
    encoding and each time I get a connection time out error. It seems
    that fopen cannot open a webpage in GB2312. Is there a way around
    this? Has anyone else had this sort of problem?

    Here is an example with some simple code (using PHP5):

    $file = fopen("http://top.baidu.com/winkvane.html", "r") or
    exit("Unable to open file!");

    while(!feof($fi le))
    {
    echo fgets($file). "<br />";
    }
    fclose($file);

    Any ideas would be greatly appreciated! Thank you.
    Sadie

Working...