Jump to content

Recommended Posts

I'm trying to add a cookiefile through in array -- like the following:

 

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie[$he][loc]);

 

However, curl isn't registering it for some reason. I print "$cookie[$he][loc]" and it's to the direct path, and I've used is_string and it returns true.. so why can't I use this with curl?

 

Is there a fix I can use to incorporate "$cookie[$he][loc]"?

Link to comment
https://forums.phpfreaks.com/topic/169743-solved-curl-trouble/
Share on other sites

Set it as a member property

<?php
class foo {
private $cookiePath;

public function __construct($path) {
	$this->cookiePath = $path;
}

public function bar() {
	curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookiePath);   
	curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookiePath);
}
}

$x = new foo($cookie[$he][loc]);
$x->bar();
?>

Link to comment
https://forums.phpfreaks.com/topic/169743-solved-curl-trouble/#findComment-895504
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.