Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function soap() {
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open('POST', 'http://url.1cws', true);
- xmlhttp.withCredentials = 1;//с это строкой и без нее результат одинаковый
- xmlhttp.setRequestHeader('Authorization', 'Basic ' + btoa("user:pass"));
- var sr = '
- <v:Envelope xmlns:i="http://localhost/rt2"
- xmlns:d="http://localhost/rt2" xmlns:c="http://localhost/rt2"
- xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
- <v:Header />
- <v:Body>
- <GetShopCategoriesList
- xmlns="http://localhost/rt2" id="o0" c:root="1" />
- </v:Body>
- </v:Envelope>';
- xmlhttp.onreadystatechange = function () {
- if (xmlhttp.readyState == 4) {
- if (xmlhttp.status == 200) {
- alert(xmlhttp.resposeText);
- }
- }
- }
- xmlhttp.send(sr);
- }
- $username='user';
- $password='pass';
- $URL='http://url.1cws';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$URL);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
- curl_setopt($ch, CURLOPT_POSTFIELDS, '
- <v:Envelope xmlns:i="http://localhost/rt2"
- xmlns:d="http://localhost/rt2" xmlns:c="http://localhost/rt2"
- xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
- <v:Header />
- <v:Body>
- <GetShopCategoriesList
- xmlns="http://localhost/rt2" id="o0" c:root="1" />
- </v:Body>
- </v:Envelope>');
- $data = curl_exec($ch);
- curl_close($ch);
- echo($data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement