norbi35 Posted May 7, 2017 Share Posted May 7, 2017 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. 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.