cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Help

From: yong wang <wangyongman_at_gmail.com>
Date: Tue, 24 Jan 2012 09:26:44 +0900

if you got the connect time. you could connect
http://birdhunter2.thehunter.com/.
the reason that you do not get the info is not in php code.
It was changed with http://birdhunter2.thehunter.com/ perhaps.

$post = "email=".$usermail."&password=".$password."&frm_action=login";
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

you should check the post code of http://birdhunter2.thehunter.com/.

Good luck to you.

2012/1/23, trophy_at_tele2.se <trophy_at_tele2.se>:
> I get this so it does connect Took 0.828416 seconds to send a request to
> http://birdhunter2.thehunter.com/
> but i dont get the info??
>
> and with out your code i get Connection problem.
>
> Regards
> Anders
>
> -----Ursprungligt meddelande-----
> From: yong wang
> Sent: Monday, January 23, 2012 1:23 AM
> To: curl with PHP
> Subject: Re: Help
>
> you change the sourse from
>
> $header = curl_getinfo( $ch );
> curl_close($ch);
>
> to
>
> if(!curl_errno($ch))
> {
> $info = curl_getinfo($ch);
> echo 'Took ' . $info['total_time'] . ' seconds to send a request to '
> . $info['url'];
> }
> curl_close($ch);
> exit();
>
> run it and what's output?
>
> 2012/1/20, trophy_at_tele2.se <trophy_at_tele2.se>:
>> still same problem :-(
>>
>> -----Ursprungligt meddelande-----
>> From: yong wang
>> Sent: Friday, January 20, 2012 1:16 AM
>> To: curl with PHP
>> Subject: Re: Help
>>
>> Hi,The problem is that Url was changed perhaps.
>> if it changed from http://secure.thehunter.com/submit/
>> to http://secure.thehunter.com/.
>> You should change $this->authId = $securestr[4];
>> to $this->authId = $securestr[3];
>>
>> Hope This Helps You
>>
>> Regards
>> wy
>>
>>
>>
>> 2012/1/19, trophy_at_tele2.se <trophy_at_tele2.se>:
>>> Hi Please can you have a look at this it did work 2 month ago but now i
>>> just
>>> get Connection problem.
>>> it get info to my signature i have on my site!
>>> <?php
>>> class IdsManager
>>> {
>>> private $login = "mail adress";
>>> private $pw = "xxxxxxxxxx";
>>> private $authId;
>>> private $playerId;
>>> private $authIdFile;
>>> private $player;
>>> public function __construct($playerName)
>>> {
>>> $this->authIdFile = fopen('ramdisk/authid', 'r');
>>> $this->authId = fgets($this->authIdFile);
>>> $this->retrieveAuthAndPlayerId($playerName);
>>> $this->player = $playerName;
>>> fclose($this->authIdFile);
>>> }
>>> private function connection()
>>> {
>>> $usermail = urlencode($this->login);
>>> $password = urlencode($this->pw);
>>> $post = "email=".$usermail."&password=".$password."&frm_action=login";
>>> $ch = curl_init("http://secure.thehunter.com/submit/");
>>> curl_setopt($ch, CURLOPT_HEADER, 1);
>>> curl_setopt($ch, CURLOPT_POST, 1);
>>> curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
>>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>>> $response = curl_exec($ch);
>>> $header = curl_getinfo( $ch );
>>> curl_close($ch);
>>> unset($ch);
>>> $securestr = explode("/", $header['url']);
>>> $this->authId = $securestr[4];
>>> fclose($this->authIdFile);
>>> $this->authIdFile = fopen('./ramdisk/authid', 'w');
>>> fseek($this->authIdFile, 0);
>>> fputs($this->authIdFile, $this->authId);
>>> }
>>> private function retrieveAuthAndPlayerId($playerName)
>>> {
>>> if(empty($this->authId))
>>> {
>>> $this->connection();
>>> }
>>> $this->retrievePlayerIdFromSite($playerName);
>>> if($this->playerId === 0)
>>> {
>>> $this->connection();
>>> $this->retrievePlayerIdFromSite($playerName);
>>> }
>>> }
>>> private function retrievePlayerIdFromSite($playerName)
>>> {
>>> $ch =
>>> curl_init("http://"/.$playerName.".thehunter.com/sid/".$this->authId."/site/statistics/");
>>> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>>> curl_setopt($ch, CURLOPT_HEADER, 1);
>>> $response = curl_exec($ch);
>>> $header = curl_getinfo( $ch );
>>> curl_close($ch);
>>> unset($ch);
>>> if(strpos($header['url'], "reason=no-profile-exists"))
>>> {
>>> $this->playerId = -1;
>>> } elseif($header['url'] == "http://www.thehunter.com/pub/")
>>> {
>>> $this->playerId = 0;
>>> } else {
>>> $useridpos = strpos($response, "onclick=") + 12;
>>> $this->playerId = substr($response, $useridpos, 11);
>>> }
>>> }
>>> public function getPlayerId()
>>> {
>>> return $this->playerId;
>>> }
>>> public function getAuthId()
>>> {
>>> return $this->authId;
>>> }
>>> public function getPlayerName()
>>> {
>>> return $this->player;
>>> }
>>> public function isValid()
>>> {
>>> return (!empty($this->authId) && !empty($this->playerId) &&
>>> $this->playerId
>>> != -1);
>>> }
>>> }
>>> ?>
>>> Hope you can help me out with this....it did work 2 months ago!
>>> Regards
>>> Anders
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
>> _______________________________________________
>> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2012-01-24