bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

am having script working on my pc. but when i host it to web hosting provider space. i get this error

malformed JSON string, neither tag, array, object, number, string or a +tom, at character offset 0 (before "Can't connect to ip...")

but works on my pc very well. i think its hosting provider problem blocking connection

here is my code

my $req = HTTP::Request->new(POST => 'http://ip:4000'); $req->content_type('application/x-www-form-urlencoded'); $req->content_type('application/json'); my $res = $ua->request($req); $respons = JSON::XS->new->decode ($res->content); $dat = $respons->{data}; $adat1 = $respons->{name};

Replies are listed 'Best First'.
Re: http ip connection
by Corion (Patriarch) on Jun 20, 2017 at 10:37 UTC

    What you get back is an error message.

    Try printing out $res->content, and also $res->status. Also check $res->is_error.

      am not sure this can do anything. the problem is not with script coz works at my side. bt not hosting space. i think hosting idea can fix this. someone told me to try to tell my host for enabling ipv6

        i have understand it now. this works but failed in Apache . which is like Apache not accepting connection from ip:400. i think htacess can solve this. to let apache accept connecting to ip:400