Skip to content

Instantly share code, notes, and snippets.

@veb
Last active September 10, 2015 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veb/7ce56bf09a2cc8e5f0f6 to your computer and use it in GitHub Desktop.
Save veb/7ce56bf09a2cc8e5f0f6 to your computer and use it in GitHub Desktop.
articles-11
<?
// original curl request up here
if ($headers['http_code'] == 302){
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $headers['redirect_url']);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt'); // set cookie file to given file
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt'); // set same file as cookie jar
$content = curl_exec($ch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment