title: What wrong with my cURL?
body: <p>Good day, I want to get the response from a URL using cURL then assign the data to PHP variables but my cURL returns NULL value even the URL has data. I searched and tried every solution in a similar situation but I fail . Hope someone can help me fix this problem. </p>
  
  <p>this is the data of the URL "<a href="http://localhost/sample/testURL.php" rel="nofollow noreferrer">http://localhost/sample/testURL.php</a>"</p>
  
  <pre><code>{
    "login": {
      "error": false,
      "user": {
        "br_code": 0,
        "mem_id": 202
      }
    },
    "branch": {
      "error": false,
      "branch_info": {
        "br_id": 0,
        "br_desc": "OFFICE 1",
        "br_add": "Sample Address",
        "br_manager": "John Doe",
        "br_accronym": "",
        "br_trans_date": "2017-08-05"
      }
    },
    "accounts": {
      "error": false,
      "sl_summ": [
        {
          "sl_desc": "Sampe Account",
          "tr_date": "2017-09-04",
          "actual_balance": "100.00",
          "available_balance": "100.0"
        }
      ]
    }
  }
  </code></pre>
  
  <p>this is the code of my cURL that returns NULL </p>
  
  <pre><code>&lt;?php
  session_start();
  
  $url= 'http://localhost/sample/testURL.php';
  $ch = curl_init($url);
  
  $br_code= $_SESSION["BR_CODE"];
  $client_id= $_SESSION["MEM_ID"];
  
  // set post fields
  $post = [
      'br_code' =&gt; $br_code,
      'client_id' =&gt; $client_id
  ];
  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  
  // execute!
  $response = curl_exec($ch);
  
  print_r(curl_getinfo($ch));
  
  if(curl_errno($ch)){
      echo 'Curl error: ' . curl_error($ch);
  }
  
  // close the connection, release resources used
  curl_close($ch);
  
  $obj= json_decode($response, true);
  
  // do anything you want with your response
  var_dump($obj);          //returns NUll
  var_dump($br_code);      //returns 0
  var_dump($client_id);    //returns 202
  ?&gt;
  </code></pre>
  
  <p>return value with  curl_getinfo()</p>
  
  <pre><code>Array
  (
      [url] =&gt; http://localhost/coredev_localserver/accountsummary.php
      [content_type] =&gt; text/html; charset=UTF-8
      [http_code] =&gt; 200
      [header_size] =&gt; 393
      [request_size] =&gt; 216
      [filetime] =&gt; -1
      [ssl_verify_result] =&gt; 0
      [redirect_count] =&gt; 0
      [total_time] =&gt; 0.078
      [namelookup_time] =&gt; 0.015
      [connect_time] =&gt; 0.031
      [pretransfer_time] =&gt; 0.031
      [size_upload] =&gt; 244
      [size_download] =&gt; 304
      [speed_download] =&gt; 3897
      [speed_upload] =&gt; 3128
      [download_content_length] =&gt; 304
      [upload_content_length] =&gt; 244
      [starttransfer_time] =&gt; 0.031
      [redirect_time] =&gt; 0
      [redirect_url] =&gt; 
      [primary_ip] =&gt; ::1
      [certinfo] =&gt; Array
          (
          )
  
      [primary_port] =&gt; 80
      [local_ip] =&gt; ::1
      [local_port] =&gt; 52160
  )
  NULL           
  int(0)        
  int(202)      
  </code></pre>