Created
October 13, 2017 08:45
-
-
Save anonymous/3faf8328dd68dffab0b0a3d25bc6b71b to your computer and use it in GitHub Desktop.
Thank you so much for helping me, I set this code up, is that okay?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Shopper functions and definitions | |
* | |
* @link https://developer.wordpress.org/themes/basics/theme-functions/ | |
* | |
* @package Shopper | |
*/ | |
/** | |
* Assign the shopper version to a var | |
*/ | |
$shopper_theme = wp_get_theme( 'shopper' ); | |
$shopper_version = $shopper_theme['Version']; | |
/** | |
* Set the content width based on the theme's design and stylesheet. | |
*/ | |
if ( ! isset( $content_width ) ) { | |
$content_width = 980; /* pixels */ | |
} | |
$shopper = (object) array( | |
'version' => $shopper_version, | |
/** | |
* Initialize all the things. | |
*/ | |
'main' => require 'inc/class-shopper.php', | |
'customizer' => require 'inc/customizer/class-shopper-customizer.php', | |
); | |
require 'inc/shopper-functions.php'; | |
require 'inc/shopper-template-hooks.php'; | |
require 'inc/shopper-template-functions.php'; | |
/** | |
* All for WooCommerce functions | |
*/ | |
if ( shopper_is_woocommerce_activated() ) { | |
$shopper->woocommerce = require 'inc/woocommerce/class-shopper-woocommerce.php'; | |
require 'inc/woocommerce/shopper-wc-template-hooks.php'; | |
require 'inc/woocommerce/shopper-wc-template-functions.php'; | |
} | |
add_action( 'user_register', 'xml', 10, 1 ); | |
$xml = "<customer><activation-code>".rand(100000,999999)."</activation-code> | |
<area-code-id type=\"integer\"></area-code-id> | |
<billing-failure-date type=\"datetime\" nil=\"true\"/> | |
<created-at type=\"datetime\"></created-at> | |
<email>".$current_user->user_email."</email> | |
<first-name>".$valueVorname."</first-name> | |
<id type=\"integer\"></id> | |
<language-id type=\"integer\">2</language-id> | |
<last-name>".$valueNachname."</last-name> | |
<npvr-limit type=\"integer\" nil=\"true\"/> | |
<npvr-quota type=\"integer\">360000</npvr-quota> | |
<other-than-stb-devices-limit type=\"integer\">1</other-than-stb-devices-limit> | |
<phone></phone> | |
<pin>".rand(1000,9999)."</pin> | |
<pvr-limit>NO_LIMIT</pvr-limit> | |
<secondary-pin>".rand(1000,9999)."</secondary-pin> | |
<status>enabled</status> | |
<stb-devices-limit type=\"integer\">1</stb-devices-limit> | |
<updated-at type=\"datetime\"></updated-at> | |
<uuid></uuid> | |
<external-id nil=\"true\"/> | |
<npvr-quota-used type=\"integer\">1</npvr-quota-used> | |
<npvr-limit-used type=\"integer\">1</npvr-limit-used> | |
<area-code-external-id nil=\"true\"/> | |
<language-external-id nil=\"true\"/> | |
<address-attributes> | |
<city>".$valueOrt."</city> | |
<street>".$valueStrasse."</street> | |
<postal-code>".$valuePost."</postal-code> | |
<province-id>119</province-id> | |
</address-attributes> | |
</customer>"; | |
$url = 'https://yyy.xxx.xx.xx:xxxx/rest/customers'; | |
$ch = curl_init(); | |
curl_setopt( $ch, CURLOPT_URL, $url ); | |
curl_setopt( $ch, CURLOPT_POST, true ); | |
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml','Authorization: Basic QTFDVjVsaGl5d1d2NXh3UWJ0OFE6')); | |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); | |
curl_setopt( $ch, CURLOPT_POSTFIELDS, $xml ); | |
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false); | |
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt( $ch, CURLOPT_TIMEOUT, 10); | |
$data = curl_exec($ch); | |
//print $data; | |
//var_dump($data); | |
$xml = simplexml_load_string($data); | |
$json = json_encode($xml); | |
$arr = json_decode($json,true); | |
//print_r($arr['id']); | |
if(curl_errno($ch)) | |
print curl_error($ch); | |
else | |
curl_close($ch); | |
$resultVorname = wpuef_get_field('c11'); | |
$valueVorname=$resultVorname->value; | |
echo $valueVorname, "<br>"; | |
$resultNachname = wpuef_get_field('c15'); | |
$valuenachname=$resultNachname->value; | |
echo $valueNachname, "<br>"; | |
$resultStrasse = wpuef_get_field('c23'); | |
$valueStrasse=$resultStrasse->value; | |
echo $valueStrasse, "<br>"; | |
$resultPostleitzahl = wpuef_get_field('c31'); | |
$valuePost=$resultPostleitzahl->value; | |
echo $valuePost, "<br>"; | |
$resultOrt = wpuef_get_field('c35'); | |
$valueOrt=$resultOrt->value; | |
echo $valueOrt, "<br>"; | |
$resultTelefon = wpuef_get_field('c43'); | |
$valueTelefon=$resultTelefon->value; | |
echo $valueTelefon, "<br>"; | |
$resultSprache = wpuef_get_field('c12'); | |
$value1=$resultSprache->value; | |
echo $value1, "<br>"; | |
echo 'User email: ' . $current_user->user_email . '<br />'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment