• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick Question for PHP gurus

SunnyD

Belgian Waffler
How do I have a script pull a remote webpage into a local variable for parsing?

Thanks in advance.

NM - I found it. I'm just dumb. -- New issue, read below...
 
what OS are you running on ....you best bet if its unix based is to try and use wget I would bet and then parse the file with regexp
 
Originally posted by: mugsywwiii
file() function? It can open remote files I think.

you would be correct, but I don't think it works over https and you need to have fopen wrappers turned on and http has to be allowed. since you control the server, it should not be a problem.
 
Err...okay, now I have a real problem. The data I'm trying to get at appears to be script-generated from a database itself. fopen works somewhat, however I get just about the first 2k of the page (to the scripted stuff from their server) and then it's empty.

And manly, no, not yet. Hopefully I'll find out this week.
 
unless the content is all Javascript rendered it should be basic HTML...even if it is Javascript you can still parse the code and pull out the strings.
 
Originally posted by: SunnyD
Err...okay, now I have a real problem. The data I'm trying to get at appears to be script-generated from a database itself. fopen works somewhat, however I get just about the first 2k of the page (to the scripted stuff from their server) and then it's empty.

And manly, no, not yet. Hopefully I'll find out this week.

well, first off, it occurs to me that this is the wrong forum...now that I have that off my chest...

can you fetch a larger non-dynamic page elsewhere? just to be sure that it is the dynamic output that's messing you up.
Also, what do you mean script generated? As in CGI/PHP scripting, or javascript? Also, if you're using php 4.3 +, you want file_get_contents() I think or file(). Also, check that you're not trying to fetch a page with an iframe...I think I recall that being problematic in some cases.
 
Originally posted by: yoda291

well, first off, it occurs to me that this is the wrong forum...now that I have that off my chest...

can you fetch a larger non-dynamic page elsewhere? just to be sure that it is the dynamic output that's messing you up.
Also, what do you mean script generated? As in CGI/PHP scripting, or javascript? Also, if you're using php 4.3 +, you want file_get_contents() I think or file(). Also, check that you're not trying to fetch a page with an iframe...I think I recall that being problematic in some cases.

I know yoda, I was hoping it would be a quick answer that could slide through OT relatively unnoticed. I'm sure the mods will be moving us over to Programming shortly.

Anyway, their pages are all /jsp pages, fwiw. I'm sure they have to be using CGI or something similar to connect to their database to retrieve their statistics. I'm not certain. I did just try to pull www.yahoo.com through PHP, and it did come through in its entirity. Oddly, I figured I'd telnet in and plop a GET request on their server with the url I want, and for some reason I've managed to repeatedly crash my own windows box when I paste the url in. Odd.

Anyway... for you and mugsy, the url I am trying to work with at this moment is http://myplanetside.station.sony.com/character.jsp?charId=530262&worldId=16 -- tryin to work on a friend's "clan" page for them. It's a shame that planetside doesn't just export XML data or something like most other games do these days.
 
Back
Top