Forums » Developers



Curl Issues

Hi All,

I am trying to log events using curl.

We have a whitelabel reseller account and on one of our clients websites we are trying to use the following code to log events but to no result.

Am i missing something here? does the href actually have to match a page on the website?


$href = urlencode("#create-a-sports-mates-listing");
$title = urlencode("Created a Listing");
$ref = urlencode($_SERVER['HTTP_REFERER']);
$ua = urlencode($_SERVER['HTTP_USER_AGENT']);
$ip = urlencode($_SERVER['REMOTE_ADDR']);
$skey = urlencode('xxx');
$sid = urlencode('xxx');





// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, "http://stats.webfrogstudios.com.au/in.php?href='.$href.'&title='.$title.'&site_id='.$sid.'&sitekey_admin='.$skey.'&ip_address='.$ip.'&ua='.$ua");


// don't give me the headers just the content
curl_setopt($ch, CURLOPT_HEADER, 0);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// use a user agent to mimic a browser
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

// $output contains the output string
$output = curl_exec($ch);



if(curl_exec($ch) === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo 'Operation completed without any errors';
}

// close curl resource to free up system resources
curl_close($ch);



This is doing my head in any help would be greatly appreciated!

Thanks in advance guys :P

Posted Tue Feb 26 2013 9:40p by webfr***


You must be logged in to your account to post!