Jump to content

Verificar se tem HI5


Drone
 Share

Recommended Posts

Boas,

Aqui está um snippet para ir buscar a foto de um utilizador ao HI5

Para tal basta ir ao http://dominio.pt/link_do_script.php?email=emaildosujeito@aqui.com

$email = urldecode($_GET['email']);

$referer = "http://google.pt";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$cookies = "cookies.txt";

$url = "http://hi5.com/friend/processNameSearch2.do";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
$result = curl_exec ($ch);
curl_close ($ch);

$post = 'email='.$email.'&type=1&function=searchEmail&searchNew=1&submit2=Pesquisar';
$url = "http://hi5.com/friend/processNameSearch2.do";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
$result = curl_exec ($ch);
curl_close ($ch);

preg_match_all("/<a href=\"(.*)\">/", $result, $userID);

if (strlen($userID[0][4]) > 36) {
	echo $userID[0][4];
} else {
	echo "N/A";
}
Link to comment
Share on other sites

na minha opiniao cURL é muito porreiro, ouvi falar do cURL atraves de um script que tenho que é para importar os contactos do Hotmail, gmail, yahoo e afins...

resumidamente e pelo que percebi cURL é como se fosse uma pessoa a visitar uma pagina, fazer login etc etc.. se é que me percebes, mas automaticamente claro 😄

pode-se fazer coisas engraçadas 🙂

Link to comment
Share on other sites

@ptrci

Provávelmente o teu host não tem o Curl instalado.  :dontgetit:

Dependências

Para poder usar as funções CURL você precisa instalar o pacote CURL. PHP requer que você use o CURL 7.0.2-beta ou posterior. PHP não irá funcionar com qualquer versão anterior a CURL 7.0.2-beta. No PHP 4.2.3, você precisa do CURL versão 7.9.0 ou posterior. A partir do PHP 4.3.0, você precisa da CURL versão que seja 7.9.8 ou posterior. PHP 5.0.0 irá precisar provavelmente da CURL versão posterior a 7.10.5

Our lives begin to end the day we become silent about things that matter - Martin Luther King

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.