Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   C++ HTTP request [HELP] (http://www.go4expert.com/forums/cpp-http-request-help-t18642/)

danpe 21Jul2009 06:37

C++ HTTP request [HELP]
 
Ok so i have everything, but nothing works.

the respone receiver:

Code:

class LLAuthorize : public LLHTTPClient::Responder
{
public:
        LLAuthorize()
        {
        }

        virtual void error(U32 status, const std::string& reason)
        {
                llinfos << "Blabla: error " << status << " " << reason << llendl;
                /*OSMessageBox(                //Crashes the viewer in case there's an error
                        msg2.c_str(),
                        NULL,
                        OSMB_OK);*/
                        while(true){}
                return;
        }
        virtual void result(const LLSD& content)
        {       
                llinfos << "Response:: " << content["txt"].asString() << llendl;
                int check;
                std::string web_auth="";//lets hope for good b ut wait
                std::string msg1="EndLookup";
                std::string msg2="Success";
                web_auth=content;
                if((check = strcmp(web_auth.c_str(),msg1.c_str())) == 0)
                {
                        while(true){}
                }
                else if((check = strcmp(web_auth.c_str(),msg1.c_str())) == 0)
                {
                        llinfos << "Success" << llendl;
                }
        }
};

Now lets explain the problam exectly...
Lets say ALL works until it gets to the respone...
The PHP file returns the right respone but the C++ doesn't show it n the Debug console:
llinfos << "Response:: " << content["txt"].asString() << llendl;
this line write this: "INFO: LLAuthorize::result: Respone::" To the console... [EMPTY]

I dont know whats wrong.

Please help me, if you need anything else from me to post just ask ;)

thanks.

danpe 21Jul2009 06:38

Re: C++ HTTP request [HELP]
 
the PHP:
PHP Code:

<?php

$doc 
= new DOMDocument();
$doc->load'readonly.xml' ); 

$user $doc->getElementsByTagName("user"); 

$user_data=$_GET['a'];
$txt "EndLookup";
foreach( 
$user as $value 

    
$strings $value->getElementsByTagName("string"); 
    
$string  $strings->item(0)->nodeValue;
    
    if(
$string == $user_data)
    {
        
$txt "Success";
        break;
    }


echo 
"<llsd>\n<map>\n<string>".$txt."</string>\n</map>\n</llsd>";
?>

Sorry for double post, it didnt let me put all in 1 post.


All times are GMT +5.5. The time now is 17:00.