1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ HTTP request [HELP]

Discussion in 'C++' started by danpe, Jul 21, 2009.

  1. danpe

    danpe New Member

    Joined:
    Jul 21, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. danpe

    danpe New Member

    Joined:
    Jul 21, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    the PHP:
    PHP:
    <?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.
     

Share This Page