norbi35 Posted May 7, 2017 Share Posted May 7, 2017 (edited) Hello. My task is to send the following HTTP POST request: "http://www.supersaas.com/api/bookings.json?schedule_id=323300&password=gherer4hg324234FGgg&user_id=4412206&booking[slot_id]=18212470" (parameters values aren't real) So I wrote the following php code: $password= 'gherer4hg324234FGgg';$schedule_id = 323300;$jsonurl = "http://www.supersaas.com/api/bookings.json";$data_for_supersaas = "user_id=" . "4412206" . "&booking[slot_id]=" . "18212470"; $ch = curl_init( $jsonurl );curl_setopt( $ch, CURLOPT_POST, 1);curl_setopt( $ch, CURLOPT_POSTFIELDS, $data_for_supersaas);curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt( $ch, CURLOPT_HEADER, 1);curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt( $ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);curl_setopt( $ch, CURLOPT_USERPWD, $schedule_id . ":" . $password);$response = curl_exec( $ch ); Could someone please take a look at the curl and advice what I'm doing wrong (assuming that all of the parameters values are proper). I still receive; {"errors":[{"status":"404","title":"Not found"}]} Please help. Edited May 7, 2017 by norbi35 Quote Link to comment Share on other sites More sharing options...
requinix Posted May 7, 2017 Share Posted May 7, 2017 The response will be 404 Not Found if the schedule doesn’t exist Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.