質問編集履歴
2
修正しました!!!
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,13 +50,17 @@
|
|
50
50
|
$url='http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key='.$key.'&count='.$count.'&large_area='.$large_area.'&start='.$start.'&id='.$id.'&format='.$format;
|
51
51
|
$xml=simplexml_load_file($url);
|
52
52
|
$total_count=$xml->results_available;
|
53
|
+
if(!$xml->shop){ echo 'No result!!';
|
54
|
+
} else {
|
53
55
|
?>
|
54
56
|
|
55
57
|
```
|
56
58
|
そして、htmlです。
|
57
59
|
```html
|
58
60
|
<table border="1">
|
61
|
+
<body>
|
62
|
+
<?php foreach($xml->shop as $r){ ?>
|
59
|
-
|
63
|
+
<tr><td>
|
60
64
|
<?php echo $r->food->name; ?>
|
61
65
|
</td></tr>
|
62
66
|
<tr><td>
|
1
phpコードを提示します。
title
CHANGED
File without changes
|
body
CHANGED
@@ -35,4 +35,37 @@
|
|
35
35
|
</td>
|
36
36
|
</tr>
|
37
37
|
</table>
|
38
|
-
```
|
38
|
+
```
|
39
|
+
|
40
|
+
自分が作成したphpを表示していなかったので、表示します。
|
41
|
+
まず、パラメータです。
|
42
|
+
```php
|
43
|
+
<?php
|
44
|
+
$key='私のkey';
|
45
|
+
$count='10';
|
46
|
+
$large_area='Z014';
|
47
|
+
$start =1;
|
48
|
+
$id=$_GET ["id"];
|
49
|
+
$format='xml';
|
50
|
+
$url='http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key='.$key.'&count='.$count.'&large_area='.$large_area.'&start='.$start.'&id='.$id.'&format='.$format;
|
51
|
+
$xml=simplexml_load_file($url);
|
52
|
+
$total_count=$xml->results_available;
|
53
|
+
?>
|
54
|
+
|
55
|
+
```
|
56
|
+
そして、htmlです。
|
57
|
+
```html
|
58
|
+
<table border="1">
|
59
|
+
<tr><td>
|
60
|
+
<?php echo $r->food->name; ?>
|
61
|
+
</td></tr>
|
62
|
+
<tr><td>
|
63
|
+
<?php echo $r->address; ?>
|
64
|
+
</td></tr>
|
65
|
+
<tr><td>
|
66
|
+
<?php echo $r->open; ?>
|
67
|
+
</td></tr>
|
68
|
+
</table>
|
69
|
+
```
|
70
|
+
これは検索結果ページです。
|
71
|
+
店舗詳細ページが作れません。
|