2
Contributors
5
Replies
19
Views
2 Years
Discussion Span
Last Post by broj1
0

Must be an issue with quotes. Try something like this:

curl -i -H "Accept: application/json" -d '{"username": "divmesselibrary", "password": "677Sure1@"}'

or:

curl -i -H "Accept: application/json" -d "{\"username\": \"divmesselibrary\", \"password\": \"677Sure1@\"}"
0

Tried the examples in the post you shared but still having issues.

Below is the code:
$data = array("username" => "xxx", "password" => "xxx");
$data_string = json_encode($data);

$ch = curl_init('http://openlibrary.org/account/login');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/javascript',
'Content-Length: ' . strlen($data_string))
);

Thanks.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.