hi I need a code to find the closest number to the symbol $ in a given url's source code
for example
http://www.somesite/somepage
the source code of this page has some prices:
code... code... code...code... code... code...
160 $
code... code... code...code... code... code...
210$
code... code... code...code... code... code...
ets'
I want a code that would return just the first number that is near the $ sign
thanks
find the closest number to symbol
Moderator: General Moderators
-
avukadomusic
- Forum Newbie
- Posts: 6
- Joined: Fri Jun 12, 2009 3:20 am
Re: find the closest number to symbol
A regex might work
(untested):
(untested):
Code: Select all
$source_code = 'source code of page';
preg_match('/\w(\d*).*?\$/',$source_code,$matches);Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
avukadomusic
- Forum Newbie
- Posts: 6
- Joined: Fri Jun 12, 2009 3:20 am
Re: find the closest number to symbol
hi , it didn't work
maybe I was not explaining good
I think it is like screen scraping
the data I need in an external website's source code
I want the program to be given a page's address
and it would search the page's source code and giving me the closest number to a given sign like $
the first time $ shows up.
maybe I was not explaining good
I think it is like screen scraping
the data I need in an external website's source code
I want the program to be given a page's address
and it would search the page's source code and giving me the closest number to a given sign like $
the first time $ shows up.