pokerbirch
January 9th, 2009, 10:22 AM
Ok, i did this in Python with PyCurl but now i've found out that the person i'm writing it for wants it in PHP. ](*,)
Basic problem is setting up curl so that i can create an instance in the class constructor and keep it until the class deconstructor is called. The question is: how do i make the curl instance available to all functions within the class? I've chopped out all the curl_setopt() stuff as it's not relevent to my problem:
class curly {
/*
NOTE: these all fail due to syntax error = unexpected '('
$ch = curl_init();
var $ch = curl_init();
public $ch = curl_init();
*/
function __construct() {
// setup curl
$ch = curl_init();
}
function __destruct() {
// clean up
curl_close($ch); // FAIL = "not a valid curl handle"
}
}
Basic problem is setting up curl so that i can create an instance in the class constructor and keep it until the class deconstructor is called. The question is: how do i make the curl instance available to all functions within the class? I've chopped out all the curl_setopt() stuff as it's not relevent to my problem:
class curly {
/*
NOTE: these all fail due to syntax error = unexpected '('
$ch = curl_init();
var $ch = curl_init();
public $ch = curl_init();
*/
function __construct() {
// setup curl
$ch = curl_init();
}
function __destruct() {
// clean up
curl_close($ch); // FAIL = "not a valid curl handle"
}
}