Не могу взорвать мыло для импорта в mysql
Привет
Я получил это право, чтобы вытащить информацию из soap - wsdl, но не могу отформатировать ее для импорта в mysql
https://fleet11.cartrack.co.za/api/[^]
Что я уже пробовал:
<pre> $dataFromTheForm = $_POST['fieldName']; $soapUrl = "https://mysite/api/"; $soapUser = "AJCP00001"; // username $soapPassword = "BAKKIE#001"; // password $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="mysite/api/"> <soapenv:Header/> <soapenv:Body> <api:endpoint.get_all_vehicles_last_positions soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <user_name xsi:type="xsd:string">?</user_name> <registration xsi:type="xsd:string">?</registration> </api:endpoint.get_all_vehicles_last_positions> </soapenv:Body> </soapenv:Envelope> '; $headers = array( "Content-type: application/x-www-form-urlencoded", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: mysite/api/#get_vehicle_list_all_details", "Content-length: ".strlen($xml_post_string), ); $url = $soapUrl; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, true); $response = curl_exec($ch); curl_close($ch); print_r(explode(',',$response,-1));
и ответная реакция
Цитата:Array ( [0] => HTTP/1.1 401 Unauthorized Date: Fri [1] => 17 Jul 2020 13:50:23 GMT Server: Apache WWW-Authenticate: Basic realm="Authentification" Vary: Accept-Encoding [2] => User-Agent Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST [3] => GET [4] => OPTIONS Access-Control-Allow-Headers: Origin [5] => X-Requested-With [6] => Content-Type [7] => Accept Access-Control-Allow-Credentials: true Content-Length: 2221 Content-Type: text/html HTTP/1.1 200 OK Date: Fri [8] => 17 Jul 2020 13:50:23 GMT Server: Apache X-SOAP-Server: NuSOAP/0.9.5 (1.123) Content-Length: 13744 Vary: Accept-Encoding [9] => User-Agent Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST [10] => GET [11] => OPTIONS Access-Control-Allow-Headers: Origin [12] => X-Requested-With [13] => Content-Type [14] => Accept Access-Control-Allow-Credentials: true Content-Type: text/xml; charset=UTF-8 131928943CM63CKGP2020-07-17 15:50:01+02-26.10796228.14736512031M54 [15] => Lakeside [16] => Kempton Park [17] => Gauteng [18] => South Africa128390376131929103CW94GBGP2020-07-17 15:49:29+02-26.15745528.16410532354Van Riebeeck Avenue [19] => Meadowbrook [20] => Germiston [21] => Gauteng [22] => South Africa91855236131929189DJ17CSGP2020-07-17 15:33:23+02-26.13019728.1595951220Lucas Road [23] => Eastleigh [24] => Edenvale [25] => Gauteng [26] => South Africa134415550131644752DZ04YCGP2020-07-16 22:17:37+02-26.12998428.1621971010Central Avenue [27] => Eastleigh [28] => Edenvale [29] => Gauteng [30] => South Africa100380393174261628FF98ZWGP2020-07-17 14:51:34+02-26.0383828.0489632840Western Bypass [31] => Bryanston [32] => Sandton [33] => Gauteng [34] => South Africa111391551176362877FJ14LJGP2020-07-17 15:25:25+02-26.13020528.1596271260Lucas Road [35] => Eastleigh [36] => Edenvale [37] => Gauteng [38] => South Africa86783525174262077FX50RTGP2020-07-17 15:49:46+02-26.11773328.145104120Greenstone Park [39] => Kempton Park [40] => Gauteng [41] => South Africa108650021115687485HG07DKGP2020-07-17 15:08:42+02-26.13025728.159412730Lucas Road [42] => Eastleigh [43] => Edenvale [44] => Gauteng [45] => South Africa54697248115687333HG07DPGP2020-07-17 15:49:58+02-26.1302928.159395180Diaz Avenue [46] => Eastleigh [47] => Edenvale [48] => Gauteng [49] => South Africa26220109116851782HH65MRGP2020-07-17 15:41:42+02-26.19483928.2277072460Boksburg [50] => Gauteng [51] => South Africa36314333124523364HL98BLGP2020-07-17 15:22:06+02-26.13027528.159397830Lucas Road [52] => Eastleigh [53] => Edenvale [54] => Gauteng [55] => South Africa42238135124523243HM02SRGP2020-07-17 08:06:36+02-25.75988128.3796093140Close to Mamelodi [56] => Gauteng [57] => South Africa74083776133862270HR66YXGP2020-07-17 15:38:36+02-29.52169631.2085222600Ballito [58] => KwaZulu-Natal [59] => South Africa67201535146454559HV78BLGP2020-07-17 14:01:24+02-26.1300728.159572440Lucas Road [60] => Eastleigh [61] => Edenvale [62] => Gauteng [63] => South Africa31580999152773681HX90JJGP2020-07-17 15:49:32+02-25.96879428.009977527Riverglen [64] => Randburg [65] => Gauteng [66] => South Africa17057893167023369HZ14SDGP2020-07-17 13:41:07+02-26.13027428.159632460Lucas Road [67] => Eastleigh [68] => Edenvale [69] => Gauteng [70] => South Africa19311645159833291JB31BYGP2020-07-17 15:08:48+02-26.1302428.1592752490Lucas Road [71] => Eastleigh [72] => Edenvale [73] => Gauteng [74] => South Africa32396495174261922JG94XXGP2020-07-17 15:49:57+02-26.12901528.21214994119Albertina Sisulu Freeway [75] => Spartan [76] => Kempton Park [77] => Gauteng [78] => South Africa26695273167435050JH04HZGP2020-07-17 12:52:13+02-26.0638128.18506433973Zuurfontein Avenue [79] => Chloorkop [80] => Kempton Park [81] => Gauteng )