Jump to content

HTTP POST request - something wrong within curl code


norbi35

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.