When I run this I get:my $text = qq("Researchers from the University of Minnesota's Institut +e on the Environment looked at 17 key crops that produce 86 percent o +f the world crop calories.); my $ua = LWP::UserAgent->new(); my $response = $ua->post( 'http://query.yahooapis.com/v1/public/yql', ['q' => "select * from contentanalysis.analyze where text='".$text +."'"] ); print $response->content();
So it doesn't like the apostrophe in the query. When I take out the apostrophe, it works like it's supposed to. Since it's a SQL-like query, I tried using double apostrophes, like you would to escape a query string in SQL, and that produced the same error. So I tried URI::Escape on the string. That yields response status of OK, but no contents in the results, i.e.<?xml version="1.0" encoding="UTF-8"?> <error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:lang=" +en-US"><description>Query syntax error(s) [line 1:96 missing EOF at ' +s']</description></error>
Anyone know how I can get this working?<?xml version="1.0" encoding="UTF-8"?> <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count= +"0" yahoo:created="2014-07-19T19:41:26Z" yahoo:lang="en-US"><results/ +></query><!-- total: 177 --> <!-- engine4.yql.ne1.yahoo.com -->
In reply to How to transmit text to Yahoo Content Analysis by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |