質問編集履歴
1
実行結果を追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,9 +33,34 @@
|
|
33
33
|
```
|
34
34
|
|
35
35
|
### 試したこと
|
36
|
+
コンテンツタイプの指定、ヘッダー情報がないことでのエラーではないかと下記コードを実行しましたがエラーになりました。
|
36
37
|
|
38
|
+
```php
|
37
|
-
|
39
|
+
<?php
|
38
40
|
|
41
|
+
$url = "https://www.hellowork.mhlw.go.jp/kensaku/GECA110010.do";
|
42
|
+
$data = array(
|
39
|
-
|
43
|
+
"tDFK1CmbBox" => 13,
|
44
|
+
"fwListNaviBtn1" => 1
|
45
|
+
);
|
40
46
|
|
47
|
+
$header = array(
|
48
|
+
"Content-Type: application/x-www-form-urlencoded",
|
49
|
+
"Content-Length: ".strlen($data)
|
50
|
+
);
|
51
|
+
|
52
|
+
$options = array("http" => array(
|
53
|
+
"method" => "POST",
|
54
|
+
"content" => http_build_query($data),
|
55
|
+
));
|
56
|
+
$text = file_get_contents($url, false, stream_context_create($options));
|
57
|
+
```
|
58
|
+
エラーメッセージ
|
59
|
+
```
|
60
|
+
Warning: strlen() expects parameter 1 to be string, array given in C:\xampp\htdocs\get_post\index.php on line 11
|
61
|
+
|
62
|
+
Notice: file_get_contents(): Content-type not specified assuming application/x-www-form-urlencoded in C:\xampp\htdocs\get_post\index.php on line 18
|
63
|
+
```
|
64
|
+
|
41
|
-
|
65
|
+
どうすれば情報を取得できるでしょうか?
|
66
|
+
よろしくお願いします。
|