Jump to content

fetchRemote


Piorun

Recommended Posts

Hi

Today i have problem with:

function getEmailGravatar(email) 
    local email = md5(string.lower(email)) 
  
    fetchRemote("http://www.gravatar.com/avatar/"..email.."?s=50",  
        function(data, errno) 
            if errno == 0 then 
                return data 
            else 
                return errno 
            end 
        end 
    ) 
end 

fetchRemote doesnt work. I mean everytime return is equals to nil. email is correctly, resource is in admin group in ACL. What im doing wrong?

Link to comment
  • MTA Team

The callback function from fetchRemote can't pass any "return" value to your getEmailGravatar this way. The function fetchRemote loads the data from gravatar.com probably asynchronous. That means you can't "wait" for the response from the page inside your function.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...