Ir para conteúdo
View in the app

A better way to browse. Learn more.

Portal do Host

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Ajuda Com Curl E Sendscore

Featured Replies

Postado

Boa noite,

 

 não tenho experiência em programar com o PHP e estou apanhando bastante para conseguir pegar os dados do sendscore via curl, eu consigo me logar no sendscore, mas não consigo acessar os links para pegar os dados.

<?php
$username="*******@***********";
$password="***********";
$url="https://www.senderscore.org/";
$cookie="cookie.txt";
$postdata	=	'email='.$username.'&password='.$password.'&Submit=Sign+in&action=localLogin';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url . "index.php");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
//curl_setopt ($ch, CURLOPT_REFERER, 'https://www.senderscore.org/lookup.php?lookup=5.39.116.51');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
curl_setopt($ch, CURLOPT_AUTOREFERER, 'https://www.senderscore.org/lookup.php?lookup=5.39.116.51');
curl_close($ch);
echo $result;
exit;
?>

No código acima eu consigo me logar no sendscore, mas não consigo passar disso !

 

 


Postado

Acho que tá faltando a opção CURLOPT_COOKIEFILE para carregar o cookie.

Não sei mas eu preferiaria usar 2 conexões, uma para se logar e salvar o cookie; a outra para carregá-lo e acessar a página final.

Não há bem nem mal que dure para sempre. Um dia tudo acaba.


Postado

Acho que tá faltando a opção CURLOPT_COOKIEFILE para carregar o cookie.

Não sei mas eu preferiaria usar 2 conexões, uma para se logar e salvar o cookie; a outra para carregá-lo e acessar a página final.

 

 

Exato, eu também faço o mesmo.


Postado
  • Autor

Jaime ou jp, pode postar um exemplo? Obrigado


Postado

Vi mais alguns erros no código

1- curl_setopt deve vir antes de curl_exec

2- No código está faltando acessar a URL para verificar o IP

 

Tente isto (cheque se o PHP do seu servidor foi compilado com cURL SSL, se não deve usar somente http):

<?php

$username="*******@***********";
$password="***********";
$url="https://www.senderscore.org/";
$cookie="cookie.txt";
$postdata    =    'email='.$username.'&password='.$password.'&Submit=Sign+in&action=localLogin';

$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, $url . "index.php");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
echo curl_exec ($ch);

curl_setopt ($ch, CURLOPT_URL, 'https://www.senderscore.org/lookup.php?lookup=5.39.116.51');
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
echo curl_exec ($ch);

curl_close($ch);

?>

Não há bem nem mal que dure para sempre. Um dia tudo acaba.



Visitante
Este tópico está impedido de receber novos posts.

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Informação Importante

Concorda com os nossos termos?

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.