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

Hello experts, I am trying to extract data from web using Connotea perl API. While extracting the data I get this error

 Invalid content type in response: text/html at mycode line 41

Mycode is the code I am using and line 41 is the code to get the tags from connotea. I learned that Connotea perl is not LWP::UserAgent. It only accepts RDF MIME types, i.e., application/xml or application/rdf+xml. text/html isn't either, and that is where your error comes from. In this case, the server is saying the content isn't RDF (as it isn't XML). Also one of the experts suggested me to use eval{} around virtually all connotea perl code. I tried but I don't understand how to deal with this. I greatly appreciate your help. Thank you, Sammed

Replies are listed 'Best First'.
Re: Invalid content type in response: text/html..error handling
by ww (Archbishop) on Jul 17, 2011 at 23:05 UTC
    Your code, some sample data, and an explanation of what Connotea is (rather than the statement that it "is not LWP::UserAgent" which is more than a little "utility-challenged" because it's likely that most of us knew that already) would perhaps help the Monks offer some suggestions.

    Lacking those, my only suggestions at this point are
    1) install one of the quasi-standard versions of Perl...
        and
    2)don't respond to your own nodes with a follow up (AKA "redundant") request for help.

      Well, thank you for your answer. Its really hard to figure out things here. I am not used to this forum and still getting familiar. Sorry for the trouble. Well, I hope giving the snippet of code and writing connotea will help monks here to understand my question. Connotea is an online reference library maintained by Nature, one of the known names in the field of life-sciences. It is a free-site. Users maintain their online reference library on connotea and I am trying to get the user information who have tagged their reference libraries which also includes the information about the references. Connotea provides perl API. As said before is the way the connotea stores their information. The line 41 as I mentioned above is some thing like this:

      my @tags = $c->posts_for(uri =>"$currentURI");

      where $currentURI comes from the list of uris I have and for which I am trying to get the information which is in the form of posts_for (this is coming from connotea perl API. This is in loop. I am using active perl 5.12.3. And I will take not to respond to my own nodes. Thank you. I hope this is more clear and will help me too. Thank you, Sammed

A reply falls below the community's threshold of quality. You may see it by logging in.