curl-and-php
Re: Help
Date: Thu, 26 Jan 2012 10:18:12 +0900
> ok i have test it and it works no erros
Yesterday, I accessed that site and fault.
Today, I access too and fault.
no erros?
Could you show the return url?
> and how will this solve the script connection problem?
I think that the reason is in thehunter site, not in php site.
>I get this so it does connect Took 0.828416 seconds to send a request to http://birdhunter2.thehunter.com/
this was in your mail. you already got the url info.
the return url is http://birdhunter2.thehunter.com/.
$securestr = explode("/", $header['url']);
$this->authId = $securestr[4];
$securestr's size is 3. $securestr[4] is over.
this problem is not in curl_getinfo.
<?php
$ch = curl_init('http://www.yahoo.com/');
curl_exec($ch);
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to '
. $info['url'];
}
curl_close($ch);
?>
Regards
Wangyong
2012/1/26, trophy_at_tele2.se <trophy_at_tele2.se>:
> You can add me at hitwalker_at_hotmail.se
>
> -----Ursprungligt meddelande-----
> From: yong wang
> Sent: Wednesday, January 25, 2012 1:46 AM
> To: curl with PHP
> Subject: Re: Help
>
> I am sorry that I could not show my msn.
> but I show my test method.
>
> firstly.
> access the http://secure.thehunter.com/submit/ in the server by other
> browser.
> you should write the follow html file.
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=Windows-31J"/>
> <title>Test</title>
> </head>
> <body>
> <form name="TestForm" method="POST"
> action="http://secure.thehunter.com/submit/">
> <center>
> email<input type="text" name="email" tabindex="1" value=""><br>
> password<input type="text" name="password" tabindex="2" value=""><br>
> frm_action<input type="text" name="frm_action" tabindex="3"
> value="login"><br>
> <input type="submit" name="search" value="search">
> </center>
> </form>
> </body>
> </html>
>
> you should get the error information.
> you check the source of http://secure.thehunter.com/submit/.
> Today I access the http://secure.thehunter.com/submit/ and fail.
> The site is down.
>
> Good luck to you.
>
> Regards
> Wangyong
>
> 2012/1/24, trophy_at_tele2.se <trophy_at_tele2.se>:
>> Have you msn or something so can you get the whole script and test it i am
>> not a coder so i dont know how to
>> check post code?
>>
>> Regards
>> Anders
>>
>> -----Ursprungligt meddelande-----
>> From: yong wang
>> Sent: Tuesday, January 24, 2012 1:26 AM
>> To: curl with PHP
>> Subject: Re: Help
>>
>> 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
>>
>> _______________________________________________
>> 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-26