Re: [PHP] Web fetching script
G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using ? $GrabURL = url.txt; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); $printing[1] = str_replace(replacedatestamp, withnewstamp, $printing[1]); fclose($file); echo $printing[1]; ? - Original Message - From: Dave [EMAIL PROTECTED] To: Ben Quinn [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:57 PM Subject: RE: [PHP] Web fetching script What response are you expecting, and what response are you getting? assuming your regex is working as expected, you are running it twice to receive the same result into 2 different variables??? why not just copy the variable after additionally, $printing is filled with the matches of your regex(10 of them according to manual) as such you have to specify which element of $printing you are wanting to print, or you will get the lovely array output I don't understand why the grab variables are there unless you need them later. Without accounting for your regex... eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing[1]; $printingb=$printing; echo $printingb[1]; I have a web fetching script that fetches text from an external URL and I would like to grab two lots of text at the same time - can anyone tell me why this isn't working? ? $GrabURL = http://grabfile.html;; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing; rewind($rf); $grab2 = eregi($GrabStart(.*)$GrabEnd, $rf, $printingb); echo $printingb; fclose($file); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Web fetching script
On Mon, 27 Aug 2001 17:10, Ben Quinn wrote: G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using ? $GrabURL = url.txt; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); $printing[1] = str_replace(replacedatestamp, withnewstamp, $printing[1]); Here, reset your start and finish criteria and do the eregi again, assigning the result to $grab2. fclose($file); echo $printing[1]; ? Unless I'm missing what you're trying to do, of course. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Manure Occurs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Web fetching script
You could do this if your $GrabStart and $GrabStop are ALLWAYS the same (Like: ###START### 10pm Blah ###STOP### ###START### 12pm Blahblah ###STOP### ) $file = file(url.txt); $str = join(\n, $file); // You can use whatever to join the rows $GrabStart = ###START###; $GrabEnd = ###STOP###; then use preg_match_all() to match everything between $GrabStart and $GrabStop. Hopefully this helped you out. -Original Message- From: Ben Quinn [mailto:[EMAIL PROTECTED]] Sent: 27. elokuuta 2001 10:41 To: Dave; [EMAIL PROTECTED] Subject: Re: [PHP] Web fetching script G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using ? $GrabURL = url.txt; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); $printing[1] = str_replace(replacedatestamp, withnewstamp, $printing[1]); fclose($file); echo $printing[1]; ? - Original Message - From: Dave [EMAIL PROTECTED] To: Ben Quinn [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:57 PM Subject: RE: [PHP] Web fetching script What response are you expecting, and what response are you getting? assuming your regex is working as expected, you are running it twice to receive the same result into 2 different variables??? why not just copy the variable after additionally, $printing is filled with the matches of your regex(10 of them according to manual) as such you have to specify which element of $printing you are wanting to print, or you will get the lovely array output I don't understand why the grab variables are there unless you need them later. Without accounting for your regex... eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing[1]; $printingb=$printing; echo $printingb[1]; I have a web fetching script that fetches text from an external URL and I would like to grab two lots of text at the same time - can anyone tell me why this isn't working? ? $GrabURL = http://grabfile.html;; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing; rewind($rf); $grab2 = eregi($GrabStart(.*)$GrabEnd, $rf, $printingb); echo $printingb; fclose($file); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Web fetching script
G'day David, Niklas As usual i'm in way over my head so i'm going to be a real pain and ask for more help Niklas, unfortunately the start and stop points change constantly, i'm hoping to get around this by using the substr() function - luckily the format (in tables) stays the same My main objective is for the file to be read once only, by the time i'm finished i'll probably be grabbing 20-30 different areas of text/numbers from a file, and i'm paying for anything over 1gig downloaded from my account each month, so it could end up quite expensive. This is an example of the file i'm grabbing from http://www.arl.noaa.gov/data/ready/usr/897_profile.txt David, i couldn't get what you said to work - any chance of a quick example? :-) - Original Message - From: David Robley [EMAIL PROTECTED] To: Ben Quinn [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 27, 2001 5:58 PM Subject: Re: [PHP] Web fetching script On Mon, 27 Aug 2001 17:10, Ben Quinn wrote: G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using ? $GrabURL = url.txt; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); $printing[1] = str_replace(replacedatestamp, withnewstamp, $printing[1]); Here, reset your start and finish criteria and do the eregi again, assigning the result to $grab2. fclose($file); echo $printing[1]; ? Unless I'm missing what you're trying to do, of course. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Manure Occurs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Web fetching script
That file doesn't exist. Put it there again so I can take a look at it. And pls notify me when it's there. :) Niklas -Original Message- From: Ben Quinn [mailto:[EMAIL PROTECTED]] Sent: 27. elokuuta 2001 11:41 To: Php-General Cc: Niklas Lampén; [EMAIL PROTECTED] Subject: Re: [PHP] Web fetching script G'day David, Niklas As usual i'm in way over my head so i'm going to be a real pain and ask for more help Niklas, unfortunately the start and stop points change constantly, i'm hoping to get around this by using the substr() function - luckily the format (in tables) stays the same My main objective is for the file to be read once only, by the time i'm finished i'll probably be grabbing 20-30 different areas of text/numbers from a file, and i'm paying for anything over 1gig downloaded from my account each month, so it could end up quite expensive. This is an example of the file i'm grabbing from http://www.arl.noaa.gov/data/ready/usr/897_profile.txt David, i couldn't get what you said to work - any chance of a quick example? :-) - Original Message - From: David Robley [EMAIL PROTECTED] To: Ben Quinn [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, August 27, 2001 5:58 PM Subject: Re: [PHP] Web fetching script On Mon, 27 Aug 2001 17:10, Ben Quinn wrote: G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using ? $GrabURL = url.txt; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); $printing[1] = str_replace(replacedatestamp, withnewstamp, $printing[1]); Here, reset your start and finish criteria and do the eregi again, assigning the result to $grab2. fclose($file); echo $printing[1]; ? Unless I'm missing what you're trying to do, of course. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Manure Occurs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Web fetching script
Hi all I have a web fetching script that fetches text from an external URL and I would like to grab two lots of text at the same time - can anyone tell me why this isn't working? ? $GrabURL = http://grabfile.html;; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing; rewind($rf); $grab2 = eregi($GrabStart(.*)$GrabEnd, $rf, $printingb); echo $printingb; fclose($file); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Web fetching script
What response are you expecting, and what response are you getting? assuming your regex is working as expected, you are running it twice to receive the same result into 2 different variables??? why not just copy the variable after additionally, $printing is filled with the matches of your regex(10 of them according to manual) as such you have to specify which element of $printing you are wanting to print, or you will get the lovely array output I don't understand why the grab variables are there unless you need them later. Without accounting for your regex... eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing[1]; $printingb=$printing; echo $printingb[1]; I have a web fetching script that fetches text from an external URL and I would like to grab two lots of text at the same time - can anyone tell me why this isn't working? ? $GrabURL = http://grabfile.html;; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing; rewind($rf); $grab2 = eregi($GrabStart(.*)$GrabEnd, $rf, $printingb); echo $printingb; fclose($file); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Web fetching script
Try this: http://www.php.net/manual/en/ref.curl.php - Original Message - From: Ben Quinn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 2:35 PM Subject: [PHP] Web fetching script Hi all I have a web fetching script that fetches text from an external URL and I would like to grab two lots of text at the same time - can anyone tell me why this isn't working? ? $GrabURL = http://grabfile.html;; $GrabStart = start; $GrabEnd = stop; $file = fopen($GrabURL, r); $rf = fread($file, 2); $grab = eregi($GrabStart(.*)$GrabEnd, $rf, $printing); echo $printing; rewind($rf); $grab2 = eregi($GrabStart(.*)$GrabEnd, $rf, $printingb); echo $printingb; fclose($file); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]