I have asked an question, here: Send JSON by cURL always returns "No access".
A kind-man has answered me by this code:
<?php
//API URL
$url = 'http://www.example.com/test.php';
$data = "?code=Sh9QA&token=0982ff3066a3c60dbd3ecf9bcafc801b"
//Initiate cURL.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Execute the request
$result = curl_exec($ch);
?>
But, I can't run it. It returns an error:
Parse error: syntax error, unexpected T_VARIABLE in D:\XAMPP\htdocs\test.php on line 8
I am using PHP 5.3 for my own working.
Is there any to fix it?