Results 1 to 3 of 3

Thread: Weather on your site

  1. #1
    Senior Member kiss's Avatar
    Join Date
    Jan 2006
    Posts
    292
    Thanks
    3
    Thanked 125 Times in 29 Posts
    Rep Power
    0

    Lightbulb Weather on your site

    PHP Code:
    <?php
     
    if ( isset( $_SERVER["HTTP_ACCEPT_ENCODING"] ) && substr_count$_SERVER["HTTP_ACCEPT_ENCODING"], "gzip" ) ) ob_start"ob_gzhandler" ) ;
     else  
    ob_start() ;
     
    $query $_POST["query"] ;
     echo 
    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" ;
     echo 
    "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n" ;
     echo 
    "<head>\n" ;
     echo 
    "<title>Weather " ucwords$query ) . "</title>\n" ;
     echo 
    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n" ;
     echo 
    "<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>\n" ;
     echo 
    "<meta name=\"description\" content=\"Describe the page\"/>\n" ;
     echo 
    "<meta name=\"keywords\" content=\"Keywords of page\"/>\n" ;
     
    //echo "<link rel=\"shortcut icon\" href=\"http://" . $_SERVER["HTTP_HOST"] . "/ico/your_weather.ico\"/>\n" ;
     //echo "<link rel=\"stylesheet\" href=\"http://" . $_SERVER["HTTP_HOST"] . "/css/your_style.css\"/>\n" ;
     
    echo "</head>\n" ;
     echo 
    "<body>\n" ;
     if ( 
    $query != "" ) {
      echo 
    "<center>\n" ;
      echo 
    ucwords$query ) . "\n" ;
      echo 
    "</center>\n" ;
      
    $ch curl_init() ;
      
    curl_setopt$chCURLOPT_URL"http://inbuzunar.mobi/meteo.php" ) ;
      
    curl_setopt$chCURLOPT_HEADER) ;
      
    curl_setopt$chCURLOPT_FRESH_CONNECT) ;
      
    curl_setopt$chCURLOPT_RETURNTRANSFER) ;
      
    curl_setopt$chCURLOPT_CUSTOMREQUEST"POST" ) ;
      
    curl_setopt$chCURLOPT_POST) ;
      
    curl_setopt$chCURLOPT_POSTFIELDS"query=" $query ) ;
      
    $curl curl_exec$ch ) ;
      
    curl_close$ch ) ;
      
    preg_match_all'/<div\sclass=\"nolink\">(.+?)<\/div>/si'$curl$matches ) ;
      
    //echo "<pre>\n" ;
      //print_r( $matches[1] ) ;
      //echo "</pre>\n" ;
      
    $totl count$matches[1] ) ;
      for ( 
    $i 0$i $totl$i++ ) {
       echo 
    "<p>" ;
       echo 
    "" str_replace( array(
        
    'Luni',
        
    'Marti',
        
    'Miercuri',
        
    'Joi',
        
    'Vineri',
        
    'Sambata',
        
    'Duminica' ), array(
        
    'Monday',
        
    'Tuesday',
        
    'Wednesday',
        
    'Thursday',
        
    'Friday',
        
    'Saturday',
        
    'Sunday' ), $matches[1][$i] ) ;
       echo 
    "</p>\n" ;
      }
     }
     echo 
    "<center>\n" ;
     echo 
    "<form action=\"" htmlentities$_SERVER["PHP_SELF"] ) . "\" method=\"post\">\n" ;
     echo 
    "<input type=\"text\" name=\"query\" maxlength=\"35\" value=\"City/Village\" onfocus=\"if(this.value=='City/Village')this.value=''\" onblur=\"if(this.value=='City/Village')this.value=''\"/>\n" ;
     echo 
    "<input type=\"submit\" value=\"Search\"/>\n" ;
     echo 
    "</form>\n" ;
     echo 
    "Information is taken from <a href=\"http://inbuzunar.mobi\">InBuzunar.Mobi</a>\n" ;
     echo 
    "</center>\n" ;
     echo 
    "<center>\n" ;
     echo 
    "« <a href=\"http://" $_SERVER["HTTP_HOST"] . "\">Back</a>\n" ;
     echo 
    "</center>\n" ;
     echo 
    "</body>\n" ;
     echo 
    "</html>\n" ;
     
    ob_end_flush() ;
    ?>
    [Only registered and activated users can see links. Click Here To Register...]Your mobile portal pocket

  2. #2
    Member
    Join Date
    Jun 2009
    Location
    Latvia
    Posts
    92
    Thanks
    11
    Thanked 1 Time in 1 Post
    Rep Power
    4

    Default

    cURL is greedy. fopen can do same magic. and y u no use google weather?

  3. #3
    Senior Member wapmetal's Avatar
    Join Date
    Mar 2009
    Location
    guam, USA
    Posts
    616
    Thanks
    82
    Thanked 22 Times in 22 Posts
    Rep Power
    5

    Default

    grabbed from his site, I think
    com site: [Only registered and activated users can see links. Click Here To Register...]
    download site: [Only registered and activated users can see links. Click Here To Register...]
    fb: [Only registered and activated users can see links. Click Here To Register...]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Weather Script
    By play^ in forum Scripts Forum
    Replies: 0
    Last Post: 27-07-11, 09:34
  2. simple weather script
    By pmbguy in forum Scripts Forum
    Replies: 10
    Last Post: 24-11-10, 08:08
  3. weather updates script for $8
    By i_love_php_mysql in forum Marketplace
    Replies: 1
    Last Post: 10-10-10, 14:28
  4. Weather script for those who been looking for
    By i_love_php_mysql in forum Snippets, Functions and Classes
    Replies: 0
    Last Post: 04-10-10, 17:26
  5. Get actual weather information
    By riderz in forum Tutorials
    Replies: 1
    Last Post: 22-03-10, 08:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19