Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to grep html text from a curl request and output grab the value that is between two html tags?

More specifically the input value of a form?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You can read content out of html downloaded via curl, using a mixture of the regular UNIX commands (so grep, awk, etc.) Exactly how depends on exactly what the form looks like and how you want to interpret it.

You can also do it with perl and other languages which have libraries which make it easier.

However, input forms only have content in the fields when some person or process fills it in locally before submitting it via a POST (or less likely a GET) request.

Input forms can have default values obviously, but it seems what you're asking is if you can somehow pull the data out of a form that's been filled in, the answer is not from curl, because curl asks the web server for the web page and you get an empty form.

Maybe you could clarify what you're trying to achieve.

share|improve this answer
    
Good enough. I'll try a different approach. –  chrisjlee Jun 24 '11 at 16:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.