|
|
|
Here's a little script to grab the weather from weather.com using ur zip code and has some basic error handling:
weather.php
| <?php
$defZipCode = "49341";
$IP = getenv("REMOTE_ADDR");
exec("whois -h whois.arin.net $IP",$arZipCode);
if(strstr(substr($arZipCode[2],-5),"-")) {
$zipCode = intval(substr($arZipCode[2],strlen($arZipCode[2]) - 10, 5));
} else {
$zipCode = intval(substr($arZipCode[2],-5));
}
if(strlen($zipCode) < 5) { $zipCode = $defZipCode; }
$url = "http://www.weather.com/weather/us/zips/$zipCode.html";
$string = implode("n", file($url));
$string2 = explode("<!-- obs include -->", $string);
$string3 = explode("<!-- forecast include -->", $string2[1]);
$string5 = explode("<CENTER>", $string3[0]);
$string4 = explode("<!-- end of obs/fcst table -->", $string3[1]);
$currentweather = $string5[0];
$extforecast = $string4[0];
echo $currentweather;
echo $extforecast;
?> | | |
|
| file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | Stock quotes from yahoo! Categories : PHP, Web Services, Arrays | | | cPanel Subdomains Creator - Create cPanel subdomains without logging into cPanel. Let your visitors create their own subdomains without your intervention. Moreover, it will inform if a subdomain is already exists. Categories : PHP, Web Services, PHP Classes | | | Amazon.com API, CURL-REST Parser. Obtain data about Amazon products (PHP5 +) Categories : PHP, Ecommerce, XML, Web Services, CURL | | | Simple SOAP Example (with SoapClient) Categories : PHP, Web Services, SOAP, Beginner Guides | | | Freshmeat.net XML-RPC - This class is meant to query Freshmeat for information about registered projects. Categories : PHP, PHP Classes, XML, Web Services | | | cPanel Email Accounts Creator Categories : PHP, PHP Classes, Email, Form Processing, Web Services | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | Function to remember password Categories : PHP, Authentication, Personalization and Membership | | | Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality. Categories : PHP, GD image library, Graphics | |
|
|
|