Skip to content

HTTP Code 0 #11

Open
Open

Description

@mcandre

When I test my php-simple-proxy installation by manually entering a remote URL in my web browser, it works fine.

But when I try to use JavaScript to get the same information, I just see:

Response: {"status":{"http_code":0},"contents":null}

var ajaxProxy = "php-simple-proxy/ba-simple-proxy.php?url=";

cardURL = ajaxProxy + cardURL;

info("Waiting for response on " + cardURL + "...");

$.ajax({
    type: "GET",
    timeout: 10000, // ms
    url: cardURL,
    cache: true,
    complete: function(response, status) {
        alert("Response: " + response.responseText);
    }
});

Activity

  1. mcandre commented on May 4, 2011

    @mcandre
    Author

    Modifying this to use $.get yields the same result, and $.get with native mode enabled returns empty response text.

  2. mathphreak commented on Oct 16, 2011

    @mathphreak

    Same issue here. I'm getting {"status":{"http_code":0},"contents":null} from both manually entering the URL and going through JavaScript (easyXDM specifically).

  3. Luciaisacomputer commented on May 2, 2016

    @Luciaisacomputer

    Make sure you are encoding your URL, I ran into this issue recently, and after bashing my head in, realized I need to use encodeURIComponent on my URL string. Once I did that, everything worked. The example on the site uses serialize() on the whole form which also encodes HTML entities. Hopefully this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions