Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- header('Content-type: text/html; charset=utf-8');
- user_Agent = 'Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0';
- $id = $_POST["id"];
- // Übernahme Formulareingabe
- $url = "http://hub.culturegraph.org/entityfacts/118540238";
- // URL festlegen
- $request_headers[] = 'Accept: application/json';
- $request_headers[] = 'charset=utf-8';
- $request_headers[] = 'Content-Type: application/json; charset=utf-8';
- $request_headers[] = 'Accept-Encoding: gzip, deflate, identity';
- $request_headers[] = 'Accept-Language: de,en-US;q=0.7,en;q=0.3';
- $request_headers[] = 'X-picturemaxx-api-key: key';
- $request_headers[] = "Authorization: Bearer token";
- $request_headers[] = 'Expect: ';
- // Optionale Anfrageoptimierungen
- $ch = curl_init($url);
- // Initiate curl
- curl_setopt($ch, CURLOPT_USERAGENT, $User_Agent);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_ENCODING, "");
- // Anfrage optimieren
- // Execute
- $result = curl_exec($ch); // Performs the Request, with specified curl_setopt() options (if any).
- curl_close($ch);
- // Closing
- $data = json_decode($result, true);
- $url2 = "https://bpk.bs.picturemaxx.com/api/v1/editing/classifications/42/elements/2156190";
- $alternativData = array();
- foreach($data['variantName'] as $alternativ) {
- echo $alternativ . " ; ";
- $alternativData[] = $alternativ;
- }
- $dataj = array (
- 'classification_element_parent_id' => 0,
- 'classification_element_matchcode' => '',
- 'classification_element_foreignref' => '',
- 'localized' =>
- array (
- 'en-us' =>
- array (
- 'classification_element_name' => '',
- ),
- 'de-de' =>
- array (
- 'classification_element_name' => substr(implode(' ; ', $alternativData),0 ,10000),
- ),
- ),
- );
- $data_json = json_encode($dataj);
- $request_headers[] = 'Content-Length: ' . strlen($data_json);
- $ch2 = curl_init($url2);
- // Set the url
- curl_setopt( $ch2, CURLOPT_URL, $url2 );
- curl_setopt($ch2, CURLOPT_USERAGENT, $User_Agent);
- curl_setopt($ch2, CURLOPT_HTTPHEADER, $request_headers);
- curl_setopt($ch2, CURLOPT_ENCODING, "");
- curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, 'PUT');
- curl_setopt($ch2, CURLOPT_POSTFIELDS, $data_json);
- // Execute
- $result2 = curl_exec($ch2); // Performs the Request, with specified curl_setopt() options (if any).
- $code = curl_getinfo($ch2, CURLINFO_HTTP_CODE);
- // Closing
- curl_close($ch2);
- $url3 = "https://bpk.bs.picturemaxx.com/api/v1/editing/classifications/42/elements/2156191";
- $birthdata = array();
- foreach($data['dateOfBirth'] as $birth) {
- echo $birth . " ; ";
- $birthData[] = $birth;
- }
- $dataj2 = array (
- 'classification_element_parent_id' => 2156190,
- 'classification_element_matchcode' => '',
- 'localized' =>
- array (
- 'en-us' =>
- array (
- 'classification_element_name' => '',
- ),
- 'de-de' =>
- array (
- 'classification_element_name' => $data['dateOfBirth'],
- ),
- ),
- );
- $data_json2 = json_encode($dataj2);
- $request_headers[] = 'Content-Length: ' . strlen($data_json2);
- $ch3 = curl_init($url3);
- // Set the url
- curl_setopt( $ch3, CURLOPT_URL, $url3 );
- curl_setopt($ch3, CURLOPT_USERAGENT, $User_Agent);
- curl_setopt($ch3, CURLOPT_HTTPHEADER, $request_headers);
- curl_setopt($ch3, CURLOPT_ENCODING, "");
- curl_setopt($ch3, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch3, CURLOPT_CUSTOMREQUEST, 'PUT');
- curl_setopt($ch3, CURLOPT_POSTFIELDS, $data_json2);
- // Execute
- $result3 = curl_exec($ch3); // Performs the Request, with specified curl_setopt() options (if any).
- $code = curl_getinfo($ch3, CURLINFO_HTTP_CODE);
- // Closing
- curl_close($ch3);
Add Comment
Please, Sign In to add comment