This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ============ OBTER DADOS DA URL: http://www.mar.mil.br/dhn/chm/tabuas/ ============ | |
$dom = new domDocument; | |
$dom->loadHTML($html); | |
$dom->preserveWhiteSpace = false; | |
$tables = $dom->getElementsByTagName('table'); | |
$rows = $tables->item(0)->getElementsByTagName('tr'); | |
$arMare = array(); | |
$gravando = 0; | |
foreach ($rows as $row) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pegatwitter($usuario, $qtd = 10){ | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'http://twitter.com/statuses/user_timeline/' . $usuario . '.json?count=' . $qtd, | |
CURLOPT_HEADER => false, | |
CURLOPT_RETURNTRANSFER => true) | |
); | |
$request = curl_exec($curl); | |
curl_close($curl); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Seu usuário do YouTube | |
$usuario = 'username'; | |
// URL do Feed RSS de vídeos de um usuário | |
$youTube_UserFeedURL = 'http://gdata.youtube.com/feeds/api/users/%s/uploads'; | |
// Usa cURL para pegar o XML do feed | |
$cURL = curl_init(sprintf($youTube_UserFeedURL, $usuario)); | |
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: application/json'); | |
$cep = $_GET['cep']; | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => 'http://cep.republicavirtual.com.br/web_cep.php?formato=javascript&cep=' . $cep, | |
CURLOPT_HEADER => false, | |
CURLOPT_RETURNTRANSFER => true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$search = "http://search.twitter.com/search.atom?q=gasolina&rpp=50&geocode=-5.794478%2C-35.210953%2C100km"; | |
$tw = curl_init(); | |
curl_setopt($tw, CURLOPT_URL, $search); | |
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE); | |
$twi = curl_exec($tw); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Validate an email address. | |
Provide email address (raw input) | |
Returns true if the email address has the email | |
address format and the domain exists. | |
*/ | |
function verificarEmail($email) | |
{ | |
$isValid = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
#forçar o www | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301] | |
# Acessar outra pasta na raiz do servidor | |
RewriteCond $1 ^(loja).*$ [NC] | |
RewriteRule (.*) - [L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Seu usuário do YouTube | |
$usuario = 'username'; | |
// URL do Feed RSS de vídeos de um usuário | |
$youTube_UserFeedURL = 'http://gdata.youtube.com/feeds/base/users/%s/uploads?orderby=updated&v=2'; | |
// Usa cURL para pegar o XML do feed | |
$cURL = curl_init(sprintf($youTube_UserFeedURL, $usuario)); | |
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("#UsuarioLogin").blur(function(){ | |
$.ajax({ | |
type: "GET", | |
url: "valido/" + $(this).val(), | |
dataType: "json", | |
beforeSend: function(){ | |
console.log("carregando..."); | |
}, | |
success: function(text){ |