2013年8月22日木曜日

XDomainRequest ドメイン間要求 (XDR) の概要(IE)

XDomainRequest

ドメイン間要求 (XDR) の概要

http://msdn.microsoft.com/ja-jp/library/dd573303(v=vs.85).aspx




<script type="text/javascript">
var xdr;
var ulink='http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=a2e61b747d51c0f4ba93c3f506e8ba3c&text=akb48&format=rest';

xdr=new XDomainRequest();
xdr.open('GET',ulink);
xdr.send();
alert(xdr.responseText);


</script>


2013年8月16日金曜日

Flickr API を確認中

Flickr API  を確認中です、認証しないで、画像の検索ができます。


flickr.photos.search

<?php
//url http://www.flickr.com/services/api/explore/flickr.photos.search
//http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg
//or
//http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}_[mstzb].jpg
//or
//http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)

$test=new flickr('秋葉原');



class flickr{

public function flickr($key){
$url='http://api.flickr.com/services/rest/?';
$imglink='http://farm%s.staticflickr.com/%s/%s_%s_b.jpg';
$imglink='http://farm%s.staticflickr.com/%s/%s_%s.jpg';
$imgshow='<img src="%s" alt="%s" title="%s" />';
$para['method']='flickr.photos.search';
$para['api_key']='********************************';
$para['text']=urldecode($key);
$para['format']='rest';
$para['sort']='date-posted-desc';
ksort($para);
echo $paraurl=$url.http_build_query($para);
$xml=simplexml_load_file($paraurl);


foreach($xml->photos->photo as $key=>$val){
$t_id=$val->attributes()->id;
$t_owner=$val->attributes()->owner;
$t_secret=$val->attributes()->secret;
$t_server=$val->attributes()->server;
$t_farm=$val->attributes()->farm;
$t_title=$val->attributes()->title;
$t_ispublic=$val->attributes()->ispublic;
$t_isfriend=$val->attributes()->isfriend;
$t_isfamily=$val->attributes()->isfamily;

$t_imglink=sprintf($imglink,$t_farm,$t_server,$t_id,$t_secret);
echo sprintf($imgshow,$t_imglink,$t_title,$t_title);
echo '<br>';
echo '<br>';

}

}

public function pinfo($ihoto_id){



}



}


?>




結果(一部)
130815@ソフマップ 秋葉原本館

アイスカフェラテ+カレードーナツ@DONQ 秋葉原店

「Google 新型Nexus7 近日入荷 16GB¥34,800 32GB¥39,800」ジャングル 秋葉原3号店

「Sushi 世の中はお盆休み中ですネ! 元祖寿司は休まずガンバッテ営業してます。ぜひっ!おいしい寿司を食べてってネ!!」元祖寿司 秋葉原中央通り店

「HTC ONE Google Edition ¥79,800」ジャングル 秋葉原3号店

「お盆特価!! WD20EZRX BOX 低発熱・静音動作・省エネ更に容量単価の安さがポイントです 2TB ¥6,980」BUY MORE 秋葉原本店

『ロットに注意!! 初期ロット無くなり次第終了です Xeon E3-1225v3 3.2GHz 本来は4コア4スレッドですが初期ロット「SR14U」のみ4コア8スレッド!!なのですっっ!! ¥24,480』BUY MORE 秋葉原本店

2013年8月4日日曜日

document getAttribute('class') .getAttribute('classname')

getAttribute() メソッドを利用して、class 属性を取得する際に、ブラウザ別に設定が必要になります。

Google Chrome
Mozilla Firefox
の場合  getAttribute('class')


Internet Explorer
の場合  getAttribute('classname')



<script type="text/javascript">
var mv=document.getElementsByTagName('div');
for (var i=0;i<mv.length; i++){
if(mv[i].getAttribute('class')=="item-title" || mv[i].getAttribute('classname')=="item-title"){

document.write(mv[i].innerText + '<br>');

}

}
</script>

2013年7月11日木曜日

確認したいPHP 関数 2つ

確認したいPHP 関数 2つあります。



print_r(get_headers($url));
print_r(get_meta_tags($url));

2013年7月10日水曜日

php 拡張子をhtml に変更して、html として動作させたい

php 拡張子をhtml に変更して、html として動作させたい、
その場合はhttpd.confを次のように記述します。


AddType application/x-httpd-php .php .html
AddHandler application/x-httpd-php .php .html


https://httpd.apache.org/docs/2.0/ja/mod/mod_mime.html
http://www.phpchina.com/resource/manual/apache/mod/mod_mime.html

2013年7月9日火曜日

名前ベースのバーチャルホスト

名前ベースのバーチャルホスト
1つのサーバで複数のドメインを運用する技術のことで、Webサーバ、メールサーバなどで利用される。httpd.conf に以下のようなコードを追加するだけです


例:
NameVirtualHost 12.152.250.116:80

<VirtualHost 12.152.250.116:80>
ServerName www.dodo.com
ServerAlias dodo.com 12.152.250.116.dodo.com
DocumentRoot /htdocs
</VirtualHost>

<VirtualHost 12.152.250.116:80>
ServerName www.mori.com
DocumentRoot /htdocs/inmori
</VirtualHost>

<VirtualHost 12.152.250.116:80>
ServerName www.akiba.com
DocumentRoot /htdocs/akiba
</VirtualHost>

https://httpd.apache.org/docs/2.0/ja/vhosts/name-based.html
http://www.souzz.net/online/apachemanual/vhosts/name-based.html









2013年7月8日月曜日

Javascript eval() 関数

var x= "(5+5)*20";
alert(eval(x));

例 このページを開くとき、すでに実行されています。