[PHP] Re: grabbing information from websites
instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: grabbing information from websites
where abouts am i putting the modifier 'm' in the expression to allow the multilines? Champinoman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=champinoman,r;); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: grabbing information from websites
i tried putting in fread() but still getting a blank screen. any other errors in here? ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=champinoman,r;); $line = fread ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] fgets() will read in from file until end of line or end of file up to the No bytes given. Is there an end of line between the username=chapinoman and the td align=right70,277 ? If there is a line break then $line will never contain both strings. You may need to use fread() instead. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 14:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=ch ampinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right(.*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right(.*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/tdm,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php