fsockopen retrieves different data than browser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

fsockopen retrieves different data than browser

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post 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 :(
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

You could try http://www.php.net/utf8_decode on the recieved string..
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

:idea: hrm... never noticed :) but i'll try it when i'm work... thanks!
Post Reply