回答編集履歴
2
ミスがあったため修正。
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
$url = "https://api.dmm.com/affiliate/v3***&output=json"; // &output=jsonにする。
|
60
60
|
|
61
|
-
$contents = file_get_contents( $
|
61
|
+
$contents = file_get_contents( $url ); // これも元のとは違います
|
62
62
|
|
63
63
|
$json = json_decode( $contents );
|
64
64
|
|
1
情報の追加。
test
CHANGED
@@ -27,3 +27,59 @@
|
|
27
27
|
【PHP: intval - Manual】
|
28
28
|
|
29
29
|
[http://php.net/manual/ja/function.intval.php](http://php.net/manual/ja/function.intval.php)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
---
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
**追記:**
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
これでもエラーが出ますか?
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
```PHP
|
48
|
+
|
49
|
+
//エラー出力強制
|
50
|
+
|
51
|
+
ini_set( 'display_errors', 1 ); // エラーを画面に表示(1を0にすると画面上にはエラーは出ない)
|
52
|
+
|
53
|
+
//すべてのエラー表示
|
54
|
+
|
55
|
+
error_reporting( E_ALL );
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
$url = "https://api.dmm.com/affiliate/v3***&output=json"; // &output=jsonにする。
|
60
|
+
|
61
|
+
$contents = file_get_contents( $json ); // これも元のとは違います
|
62
|
+
|
63
|
+
$json = json_decode( $contents );
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
$count = intval( $json->result->result_count );
|
68
|
+
|
69
|
+
if ( $count === 0 ) {
|
70
|
+
|
71
|
+
echo "DMMでは取り扱っていません";
|
72
|
+
|
73
|
+
} else {
|
74
|
+
|
75
|
+
echo "DMMでは取り扱っています";
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
【DMM API ver3.0 入門【PHP】 | コケムスシェルター】
|
84
|
+
|
85
|
+
[http://hytool.org/archives/7192](http://hytool.org/archives/7192)
|