Jump to content

ranienter

New Members
  • Posts

    3
  • Joined

  • Last visited

ranienter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I got nothing, a blank page
  2. Try this: SELECT * FROM ( SELECT * FROM Live_Data WHERE uid='$uid' AND 'Post_Date' > '2013-11-21' AND 'Post_Date' <'2013-11-22' ORDER BY id DESC ) tmp ORDER BY tmp.id ASC I encourage you not to use BETWEEN.
  3. Hey everyone, I'm trying to send a JSON array to an API via HTTP POST, get a response and print it. I tried using cURL to do so, but it doesn't seem to work. I simply get zero response, a blank page. My request: <?php $data = array( "login" => "myLogin", "password" => "myPassword", "id" => "12345", "tag" => "test" ); $json_data = json_encode($data); $ch = curl_init('URL/api/mylogin'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($json_data)) ); $output = curl_exec($ch); $result = json_decode($output); echo $result; ?> The response I should be getting: {"status": 200, "message": "OK", "login_key": "abcdefh532h235yh"} any idea why I'm not getting any response? (this works ok when I manually test it using a test REST client) Thanks, Rani
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.