changed urlencode to rawurlencode