質問編集履歴

2

追記削除

2018/05/08 05:32

投稿

tomo
tomo

スコア18

test CHANGED
File without changes
test CHANGED
@@ -21,77 +21,3 @@
21
21
 
22
22
 
23
23
  拙い説明で申し訳ないですが、ご教授いただけると幸いです。
24
-
25
-
26
-
27
- ps.
28
-
29
- 該当のソースコードです。
30
-
31
- 投稿用に一部修正してあります。
32
-
33
- ```PHP
34
-
35
- <?php
36
-
37
- private function hogessl( $xml , $targetUrl , $port = '443' )
38
-
39
- {
40
-
41
- $xml = mb_convert_encoding( $xml , 'SJIS' , 'UTF-8' );
42
-
43
- $targetParse = parse_url( $targetUrl );
44
-
45
- if( $fp = @fsockopen( "ssl://" . $targetParse[ 'host' ] , $port , $errno , $errstr , 30 ) )
46
-
47
- {
48
-
49
- fputs( $fp , "POST " . $targetParse[ 'path' ] . " HTTP/1.1\r\n" );
50
-
51
- fputs( $fp , "User-Agent:PHP/" . phpversion() . "\r\n" );
52
-
53
- fputs( $fp , "Host: \r\n" );
54
-
55
- fputs( $fp , "Connection:Close\r\n" );
56
-
57
- fputs( $fp , "Content-Type: text/xml\r\n" );
58
-
59
- fputs( $fp , "Content-Length: " . strlen( $xml ) . "\r\n\r\n" );
60
-
61
- fputs( $fp , $xml );
62
-
63
- $headers = '';
64
-
65
- while( $str = trim( fgets( $fp , 4096 ) ) )
66
-
67
- {
68
-
69
- $headers .= "$str\n";
70
-
71
- }
72
-
73
- $body = '';
74
-
75
- while( !feof( $fp ) )
76
-
77
- {
78
-
79
- $body .= fgets( $fp , 4096 );
80
-
81
- }
82
-
83
- fclose( $fp );
84
-
85
- $body = mb_convert_encoding( $body , 'UTF-8' , 'SJIS' );
86
-
87
- $this->lastResponse = $body;
88
-
89
- $responseXml = @simplexml_load_string( $body , 'SimpleXMLElement' );
90
-
91
- }
92
-
93
- return $responseXml;
94
-
95
- }
96
-
97
- ```

1

ソースコードの追記

2018/05/08 05:31

投稿

tomo
tomo

スコア18

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,77 @@
21
21
 
22
22
 
23
23
  拙い説明で申し訳ないですが、ご教授いただけると幸いです。
24
+
25
+
26
+
27
+ ps.
28
+
29
+ 該当のソースコードです。
30
+
31
+ 投稿用に一部修正してあります。
32
+
33
+ ```PHP
34
+
35
+ <?php
36
+
37
+ private function hogessl( $xml , $targetUrl , $port = '443' )
38
+
39
+ {
40
+
41
+ $xml = mb_convert_encoding( $xml , 'SJIS' , 'UTF-8' );
42
+
43
+ $targetParse = parse_url( $targetUrl );
44
+
45
+ if( $fp = @fsockopen( "ssl://" . $targetParse[ 'host' ] , $port , $errno , $errstr , 30 ) )
46
+
47
+ {
48
+
49
+ fputs( $fp , "POST " . $targetParse[ 'path' ] . " HTTP/1.1\r\n" );
50
+
51
+ fputs( $fp , "User-Agent:PHP/" . phpversion() . "\r\n" );
52
+
53
+ fputs( $fp , "Host: \r\n" );
54
+
55
+ fputs( $fp , "Connection:Close\r\n" );
56
+
57
+ fputs( $fp , "Content-Type: text/xml\r\n" );
58
+
59
+ fputs( $fp , "Content-Length: " . strlen( $xml ) . "\r\n\r\n" );
60
+
61
+ fputs( $fp , $xml );
62
+
63
+ $headers = '';
64
+
65
+ while( $str = trim( fgets( $fp , 4096 ) ) )
66
+
67
+ {
68
+
69
+ $headers .= "$str\n";
70
+
71
+ }
72
+
73
+ $body = '';
74
+
75
+ while( !feof( $fp ) )
76
+
77
+ {
78
+
79
+ $body .= fgets( $fp , 4096 );
80
+
81
+ }
82
+
83
+ fclose( $fp );
84
+
85
+ $body = mb_convert_encoding( $body , 'UTF-8' , 'SJIS' );
86
+
87
+ $this->lastResponse = $body;
88
+
89
+ $responseXml = @simplexml_load_string( $body , 'SimpleXMLElement' );
90
+
91
+ }
92
+
93
+ return $responseXml;
94
+
95
+ }
96
+
97
+ ```