Problem with curl

Posted:
in Genius Bar edited January 2014
Hi everyone,



I'm currently working on a Perl Script which is supposed to process the HTML code that is returned by Google after searching for a user-defined string. But I always get a 501 ('Not Implemented') error message back from Google. The curl command string looks like this:



Code:


curl http://www.google.com/search? --data q=query --data hl=en -g







Does anyone have an idea what my mistake is?



Greetings,

durandal

Comments

  • Reply 1 of 2
    kickahakickaha Posts: 8,760member
    Try writing the full URL you're expecting to send to curl to a string and print it before handing it to curl. I suspect that what you think you're handing to curl may not be what you actually are.



    Say, if 'query' is actually a Perl variable that's being mismangled?
  • Reply 2 of 2
    durandaldurandal Posts: 277member
    Quote:

    Originally posted by Kickaha

    Say, if 'query' is actually a Perl variable that's being mismangled?



    Well, 't proved to be a very simple mistake. The option -g that I used stands for 'globoff'. But I needed -G, which tells curl to treat the --data items as GET arguments to the given URL...



    Anyway, thx

    durandal



    EDIT: Just saw that you also have to use the -A option to specify a user-agent or Google will return an error.
Sign In or Register to comment.