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.

Edited by norbi35
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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