![]() |
get part of html file
Hi guys, I am trying to get a section of html from a website that has the following in it
Code:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"Code:
/graph-mod.swf?day=3&amht1=1.50&pmht1=2&amwind1=ssw&pmwind1=ssw&am_wind_strength1=10&pm_wind_strength1=25&amht2=2&pmht2=3&amwind2=se&pmwind2=e&am_wind_strength2=15&pm_wind_strength2=25&amht3=2.50&pmht3=1.50&amwind3=n&pmwind3=n&am_wind_strength3=20&pm_wind_strength3=20&amht4=1.50&pmht4=2.50&amwind4=nw&pmwind4=sw&am_wind_strength4=0&pm_wind_strength4=20&amht5=2.50&pmht5=3&amwind5=n&pmwind5=sw&am_wind_strength5=0&pm_wind_strength5=20&amht6=2.50&pmht6=1.50&amwind6=n&pmwind6=sw&am_wind_strength6=0&pm_wind_strength6=15 |
Can you expand a little more on the purpose of this script? Is it only grabbing data from *this* html file, or is it looking in a variety of html files for the SRC attribute of the EMBED element? Do you have local access to the file or are you grabbing it with cURL? Are you vegetarian or meatatarian?
|
cURL, What I want is to get the information that is after /graph-mod.swf? then take the data from day= onwards,
Then I want to take that data and spilt each one where the & sign is. |
You could probably do one of two things. Use a regular expression to find graph-mod.swf and grab everything after that up until the first double-quote it finds. The other possibility is to drop the entire file into a string, then find the location of the first or second occurrence using strpos, use that as an offset to find the next double-quote, the substr out what's in between. I'd go regular expression though.
|
I think I know what you mean, however can I ask if you can give an example on how to do the first way you said?
thanks |
If you still need it, here's a small example that will get you an array with all query parameters:
PHP Code:
Code:
array(37) { |
@Cypher I think you hit it on the head, Just testing it and adding a few things...
|
@Cypher I think you hit it on the head, Just testing it and adding a few things...
However did not go to plan here is the code. Code:
<?php |
It works if you remove "htmlspecialchars". Except I don't quite understand what you want to do with that class. Do you want to have a generic class where you can pass start and end text and extract everything between them and in addition choose if you want to encode all html entities?
|
Out of nothing to do, I have created two classes for you that you can use. Hope you can use php5 as I noticed that you are doing everything in php4.
Can't help you with anything else. Learn from what I've given you and let me know if something is not clear. Here's the code: PHP Code:
|
| All times are GMT. The time now is 02:42 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0