Code not working

Here my code:

	$ipaddress = file_get_contents('');
$decoded_json = json_decode($ipaddress, false);
$url = "";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Content-Type: application/json",
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$data = '{"value1":"' . htmlspecialchars($_GET["q"]) . '","value2":"' .  echo $decoded_json->ip . '"}';

curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);


Here’s my URL:, I can’t search
Here my screenshot:

alright, two things

  1. this is infinityfree not a php debugging site
  2. putting the code into a php debugger, it returns:
    “Syntax Error, unexpected T_ECHO at line 17”
    ask that at stackoverflow, dont ask at infinityfree
1 Like

Got it fixed, just a simple fix.

In the future, you need to explain your issue, and fill out the template. I know we have told you this before.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.