tags:

views:

57

answers:

1

(look also at my previous question)

I'm trying to repeat set of curlopt parameters. My script will do more thing that one - login, do something, do something else, finish. I would like some options to be the same in all steps. I was thinking about using curl copy handle or curl setopt array, but do i really need these? Isn't there php construct for repeating piece of code (so when you change it in one place changes are applied in all places in code) that would work in my case?

+5  A: 

Why can't you just make a function that sets the options the way you want them, and call it before you do the step that changes each time?

Making a function is pretty much the fundamental way to do a repetitive task.

Quick primer on making functions in PHP.

Mark Rushakoff