Jump to content

[SOLVED] Curl Trouble


N-Bomb(Nerd)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.