funktioniert ich hastebin.com eine neue Paste einreichen möchten unter Verwendung ihrer API, die ich gestolpert an: https://github.com/seejohnrun/haste-server/wiki/POST-apiPHP Curl hastebin.com API nicht
ich mehrere Möglichkeiten habe versucht, aber couldn Mach es nicht zur Arbeit. Hier ist mein einfacher Code:
if(function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://hastebin.com/documents");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, 'hello world');
//curl_setopt($ch, CURLOPT_POSTFIELDS, 'data=hello world');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('data'=>'hello world'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
$response_json = curl_exec($ch);
curl_close($ch);
$response_array = json_decode($response_json,true);
print_r ($response_array);
} else {
error_log("You need cURL to use this api!");
}
Jeder Rat würde sehr geschätzt werden. Danke im Voraus.