Re: [PHP] Need some help please.
With my limited knowledge (i.e none, lol) i was wondering if you are able to give me the code you use to do it. i will then play around with it t get Canberra, is that ok? doesn't matter if not. -- Cheers - Simon Angell Canberra ACT www.canberra-wx.com - Member of: Australian Severe Weather Association. www.severeweather.asn.au - This email is virus free. Scanned before leaving my mailbox using Norton Antivirus 2002 for Win2k Scanned with the latest definition File. "David Freeman" <[EMAIL PROTECTED]> wrote in message 009901c25fa1$ba8fb9f0$3f0a0a0a@skink">news:009901c25fa1$ba8fb9f0$3f0a0a0a@skink... > > > Thats a Nice feaure you have, How do you do that? > > I have a cron event on my server that grabs the relevant page from the > web site soon after it is updated (around 20 past each hour) using "lynx > -dump url" which then pipes the resulting page dump through grep to grab > just the line of data that includes my town and dumps that output to a > file. > > The file contains a single line of data that includes all of the > information I display plus some other stuff on the page that I don't > use. > > Within my php page I open that small file and load it into an array for > display on the page. > > Obviously there's some error checking in there for various fail > conditions and some other stuff too but that's the basics of it. > > I've looked at doing something similar for forecasts but as I don't > (yet) have a need to display them I haven't got around to it. > > The main advantage of this method is that you're not grabbing the data > on every page load but, instead, only when the data on the source web > site can reasonably be expected to have changed. > > As well as running a business with my wife I work for the BoM > and have done for about 18 years now > > CYA, Dave > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need some help please.
> Thats a Nice feaure you have, How do you do that? I have a cron event on my server that grabs the relevant page from the web site soon after it is updated (around 20 past each hour) using "lynx -dump url" which then pipes the resulting page dump through grep to grab just the line of data that includes my town and dumps that output to a file. The file contains a single line of data that includes all of the information I display plus some other stuff on the page that I don't use. Within my php page I open that small file and load it into an array for display on the page. Obviously there's some error checking in there for various fail conditions and some other stuff too but that's the basics of it. I've looked at doing something similar for forecasts but as I don't (yet) have a need to display them I haven't got around to it. The main advantage of this method is that you're not grabbing the data on every page load but, instead, only when the data on the source web site can reasonably be expected to have changed. As well as running a business with my wife I work for the BoM and have done for about 18 years now CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some help please.
Thats a Nice feaure you have, How do you do that? I have spoken to guy who made the php file and he will look into the bugs for me, also i will keep playing around with it. -- Cheers - Simon Angell Canberra ACT www.canberra-wx.com - Member of: Australian Severe Weather Association. www.severeweather.asn.au - This email is virus free. Scanned before leaving my mailbox using Norton Antivirus 2002 for Win2k Scanned with the latest definition File. "David Freeman" <[EMAIL PROTECTED]> wrote in message 005101c25f70$4f197700$3f0a0a0a@skink">news:005101c25f70$4f197700$3f0a0a0a@skink... > > > I am having trouble with a PHP script. I am not the one who > > made this and my knowledge on php is very little. > > I came across this php script > > www.canberra-wx.com/bomonster/bomonster01.php > > Tried loading this and had too many page errors to figure out what you > are doing. > > > www.canberra-wx.com/bomonster/bomonster1.php > > Ditto for this one. > > > Any help on how to get it to work would be great. > > First comment is a conceptual one rather than a programming one. > > I presume you are doing this so that every time someone loads your page > they get current information? You do know that the BoM only updates > forecasts around three to four times per day don't you? In this case it > means that every hit on your page is reloading what is, largely, static > information. You would be far better off caching the raw data on your > own server and using it from there. > > Use cron and possibly lynx to grab the raw data that you need on an > appropriate schedule (say every six hours or, alternately, around an > hour after normal release time for each forecast) and either process it > straight away to produce the display information you need or store it > locally to be processed each time the page loads. Ideally, you'd create > a static version of the page each time you grab new forecast information > and just display it. > > Once you have the data on your server you can process it accordingly > which is where the php comes in. The major hurdle is in pattern > matching and the like to find the relevant bit. > > I am currently doing something moderately similar to this on > www.outbackqld.net.au (current conditions in top right corner) and it is > working just fine with an update every hour or so being cached locally. > > I'm happy to discuss the issues of doing this further but am not > actually using php for anything but the last step - the rest of the > solution is done using a combination of cron, lynx and grep. > > CYA, Dave > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need some help please.
> I am having trouble with a PHP script. I am not the one who > made this and my knowledge on php is very little. > I came across this php script > www.canberra-wx.com/bomonster/bomonster01.php Tried loading this and had too many page errors to figure out what you are doing. > www.canberra-wx.com/bomonster/bomonster1.php Ditto for this one. > Any help on how to get it to work would be great. First comment is a conceptual one rather than a programming one. I presume you are doing this so that every time someone loads your page they get current information? You do know that the BoM only updates forecasts around three to four times per day don't you? In this case it means that every hit on your page is reloading what is, largely, static information. You would be far better off caching the raw data on your own server and using it from there. Use cron and possibly lynx to grab the raw data that you need on an appropriate schedule (say every six hours or, alternately, around an hour after normal release time for each forecast) and either process it straight away to produce the display information you need or store it locally to be processed each time the page loads. Ideally, you'd create a static version of the page each time you grab new forecast information and just display it. Once you have the data on your server you can process it accordingly which is where the php comes in. The major hurdle is in pattern matching and the like to find the relevant bit. I am currently doing something moderately similar to this on www.outbackqld.net.au (current conditions in top right corner) and it is working just fine with an update every hour or so being cached locally. I'm happy to discuss the issues of doing this further but am not actually using php for anything but the last step - the rest of the solution is done using a combination of cron, lynx and grep. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need some help please.
Hi. I am having trouble with a PHP script. I am not the one who made this and my knowledge on php is very little. I came across this php script www.canberra-wx.com/bomonster/bomonster01.php which is weather forecasting for a place called Mildura. The file that the PHP gets its info from is here... http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV17001.txt and if you look down the page you will see the Mildura forecast that the PHP draws its info output from. My Problem is that i want it to work for this file... http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDN10035.txt and i cant work out how to get it going. i have got this far www.canberra-wx.com/bomonster/bomonster1.php (look at the code, the actual outpot doesn't work..thats my problem). The part I want the PHP to do its info output is from A.C.T FORECAST (like from the Mildura in IDV17001.txt) Any help on how to get it to work would be great. Cheers - Simon Angell Canberra ACT www.canberra-wx.com - Member of: Australian Severe Weather Association. www.severeweather.asn.au - This email is virus free. Scanned before leaving my mailbox using Norton Antivirus 2002 for Win2k Scanned with the latest definition File. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need some help please
$query="INSERT INTO news VALUES($newsid,'$title','$author',$posted,'$body' )"; -Original Message- From: menezesd [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 12:03 AM To: [EMAIL PROTECTED] Subject: [PHP] Need some help please Hello Friends. I know I am asking for too much. But somehow, I am stuck with three books I am refering and still not being able to solve my problem, which I would greatly appreciate if any of you gurus can assist. The problem is as follows : I have three sections in this mail : 1. My table structure 2. My test.html file whose ACTION is testphp1.php file 3. My testphp1.php file. The problem is that I keep getting the error "error adding rows" as the rows are not adding in the database. My table structure : Table name : news Fields : newsid INT(11) title carchar(100) author varchar(40) posted INT(11) body MEDIUMTEXT My test.htm file : == Untitled Document My testphp1.php file : == Untitled Document -- 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] Need some help please
Hi. A quick hack to figure out your problem is to change: IF (mysql_query($query)){ print "Row added to table"; } else { print "error adding row"; } To: if (!$result = mysql_query($query)) { print 'Query Error: ' . mysql_error(); exit; } else { print 'Success! Row added.'; } In short, mysql_error() is your friend. Regards, Philip Olson On Tue, 2 Apr 2002, menezesd wrote: > Hello Friends. > > I know I am asking for too much. But somehow, I am stuck > with three books I am refering and still not being able to > solve my problem, which I would greatly appreciate if any > of you gurus can assist. The problem is as follows : > > I have three sections in this mail : > 1. My table structure > 2. My test.html file whose ACTION is testphp1.php file > 3. My testphp1.php file. > > The problem is that I keep getting the error "error adding > rows" as the rows are not adding in the database. > > My table structure : > > Table name : news > Fields : > newsid INT(11) > title carchar(100) > author varchar(40) > posted INT(11) > body MEDIUMTEXT > > > My test.htm file : > == > > > Untitled Document > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > My testphp1.php file : > == > > > > Untitled Document > > > > > > $link=mysql_connect("localhost","menezesd","FX3PYTys"); > if ($link){ > print "link id is $link"; > } else { > print "error connecting to database"; > } > $posted=time(); > > $query="INSERT INTO 'news' > ('newsid','title','author', 'posted', 'body') > VALUES($newsid,'$title','$author',$posted,'$body' )"; > print ($query); > > IF (mysql_query($query)){ > print "Row added to table"; > } else { > print "error adding row"; > } > mysql_close($link); > ?> > > -- > 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] Need some help please
Hello Friends. I know I am asking for too much. But somehow, I am stuck with three books I am refering and still not being able to solve my problem, which I would greatly appreciate if any of you gurus can assist. The problem is as follows : I have three sections in this mail : 1. My table structure 2. My test.html file whose ACTION is testphp1.php file 3. My testphp1.php file. The problem is that I keep getting the error "error adding rows" as the rows are not adding in the database. My table structure : Table name : news Fields : newsid INT(11) title carchar(100) author varchar(40) posted INT(11) body MEDIUMTEXT My test.htm file : == Untitled Document My testphp1.php file : == Untitled Document -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php