Using the curl method to automate import/export of courses

If you experience an error like this one:

I am trying to use `wget` to automate the exporting/importing of a course. It appears to work when I sign in URL but I am not sure and it definitely doesn't work for the import/export. 

Try using the `curl` command instead. They're very similar. Here are the commands to run:

============ one ============ 
# retrieve the csrf token 
$ curl -v -c cookies.txt -b cookies.txt

# no values to override 

============ two ============ 
# perform the actual login 
$ curl -v -c cookies.txt -b cookies.txt -d ""$( echo "$(grep csrftoken cookies.txt | sed 's/^.*csrftoken\s*//')" | tr -d '[:space:]')"" --header "Referer:

# the only value that you must override is mypassword for the real password, if another user is using the script will need to override user and password. 

============ three ============ 
# retrieve the course 
curl -v -c cookies.txt -b cookies.txt > course_name.tar.gz 

# here you will need to override the course export URL for each course, and replace course_name.tar.gz with a name for the file

Still need help? Contact Us Contact Us