teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

JavaScriptのコードも載せました。

2018/07/16 04:02

投稿

agep31
agep31

スコア29

title CHANGED
File without changes
body CHANGED
@@ -46,7 +46,36 @@
46
46
  (
47
47
  [0] => 当サイトをご利用になるためにはJavaScript対応のブラウザが必要ですまた設定でJavaScriptを有効にする必要がありますトップページお問い合わせvarroomTypeTBvarerrorvaractiveButtondaylangjafunctionusestricthttp1236312425229871241412427URL
48
48
  ```
49
+ html内のJavaScript
50
+ ```ここに言語を入力
51
+ <script type="text/javascript">
52
+ $(function() {
53
+ 'use strict';
49
54
 
55
+ // httpから始まるURL
56
+ var fullShareUrl = location.protocol + '//' + location.host + '/inttour/booking/csm/search/ISAP1100/init?courseNo=5HEP5NY1M0&deptYearMonth=201901&deptDay=22&planTypeCode=&planTypeBranchNo=&deptEndYearMonth=&deptEndDay=&isSearchTransition=true&cabinClass=0';
57
+
58
+ // facebookのdata-uri属性
59
+ $('#facebook-area').attr('href', 'http://www.facebook.com/share.php' + '?u=' + encodeURIComponent(fullShareUrl));
60
+
61
+ // Twitterリンクをセット
62
+ $('#twitter-link').attr('href', 'https://twitter.com/share?hashtags=' + encodeURIComponent('ANA,ANAツアー,ANA_海外ツアー,ANA_海外旅行,旅行,Travel') + '&text=' + encodeURIComponent(document.title) + '&url=' + encodeURIComponent(fullShareUrl));
63
+
64
+ // google+のdata-href属性
65
+ $('#google-plus-area').attr('data-href', fullShareUrl);
66
+
67
+ // メール
68
+ // mailto:?subject=[件名]&body=[本文]%0d%0a[URL]
69
+ // 件名はtitle, 本文はdescription
70
+ var description = $('meta[name="description"]').attr('content');
71
+ var mailHref = 'mailto:?subject=' + encodeURIComponent(document.title) + '&body='+ encodeURIComponent(description + '\r\n' + fullShareUrl);
72
+ $('#mail-link').attr('href', mailHref);
73
+
74
+
75
+ });
76
+ </script>
77
+ ```
78
+
50
79
  ### 補足情報(FW/ツールのバージョンなど)
51
80
 
52
81
  ubuntu18.04

1

URLを開示しました。

2018/07/16 04:02

投稿

agep31
agep31

スコア29

title CHANGED
File without changes
body CHANGED
@@ -19,7 +19,8 @@
19
19
  $opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0rn"));
20
20
  $context = stream_context_create($opts);
21
21
 
22
- $url = "hoge.co.jp"
22
+ $url ="https://www.ana.co.jp/inttour/booking/csm/search/ISAP1100/initcourseNo=5HEP5NY1M0&planTypeCode=++&planTypeBranchNo=++&deptYearMonth=201901&deptDay=22&deptEndYearMonth=&deptEndDay=&isSearchTransition=true&cabinClass=0&coopSiteCode="
23
+ ;
23
24
  $html = file_get_contents($url,false,$context);
24
25
  $dom = new DOMDocument;
25
26
  @$dom->loadHTML(