Jump to content

Script Vremea


phpguru

Recommended Posts


<?php

$query = htmlentities( $_POST["query"] ) ;

if ( $query != "" ) {

echo "<center>\n" ;

echo "<h1>[" . ucwords( $query ) . "]</h1>\n" ;

echo "</center>\n" ;

$ch = curl_init() ;

$array = array(

CURLOPT_URL => "http://inbuzunar.mobi/meteo.php",

CURLOPT_HEADER => 0,

CURLOPT_FRESH_CONNECT => 1,

CURLOPT_RETURNTRANSFER => 1,

CURLOPT_POST => 1,

CURLOPT_POSTFIELDS => "query=" . $query ) ;

curl_setopt_array( $ch, $array ) ;

$curl = curl_exec( $ch ) ;

curl_close( $ch ) ;

preg_match_all( '/<div\sclass=\"nolink\">(.+?)<\/div>/si', $curl, $matches ) ;

$totl = count( $matches[1] ) ;

for ( $i = 0; $i < $totl; $i++ ) {

echo "<p>" ;

echo $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=\"Sat/Comuna/Oras\" onfocus=\"if(this.value=='Sat/Comuna/Oras')this.value=''\" onblur=\"if(this.value=='Sat/Comuna/Oras')this.value=''\"/>\n" ;

echo "<input type=\"submit\" value=\"Cauta\"/>\n" ;

echo "</form>\n" ;

echo "</center>\n" ;

?>

DEMO: http://inbuzunar.mobi/meteo.php

Pasnic si..simplu

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.