Page 1 of 1

fsockopen retrieves different data than browser

Posted: Fri Aug 12, 2005 4:55 pm
by nickvd
I'm trying to scrape some data (not really scrape, but display better) from mls.ca. I can go to the url in my browser and it works perfectly. however, whenever i try to use file, file_get_contents, fopen, fsockopen, etc.. it either gives me access denied, or garbage (almost looks encrypted)

the url that i'm trying to grab (among others) is http://clientclick.mls.ca/PropertyResul ... &o=&Mode=1 if anyone can help me figure this out, i'd greatly appreciate it.

Btw, I AM able to display the same page inside an iframe perfectly, but it causes horiz scrolling, and that's not acceptable, i'd rather just popup a window...

Posted: Fri Aug 12, 2005 7:48 pm
by feyd
headers:

Code: Select all

Server: Microsoft-IIS/5.0
Date: Sat, 13 Aug 2005 00:48:22 GMT
P3P: policyref="http://www.mls.ca/w3c/p3p.xml", CP=" NON COM NAV INT OTPa OUR STP DSP COR"
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Content-Encoding: deflate
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 2998
X-Cache: MISS from www.mls.ca
Connection: close
Notice content-encoding, and utf8

Posted: Fri Aug 12, 2005 9:37 pm
by nickvd
So I should send those headers? I sent the one's I captured with livehttpheaders in ff, and that's when I got the garbage... I don't have a copy of it right now, I'm at home :(

Posted: Fri Aug 12, 2005 10:27 pm
by timvw
You could try http://www.php.net/utf8_decode on the recieved string..

Posted: Fri Aug 12, 2005 10:40 pm
by nickvd
:idea: hrm... never noticed :) but i'll try it when i'm work... thanks!