ܻؤ1顪30奵꡼ޥܥ

ITȤƯ30奵꡼ޥΥ饤ߥ󥰵Ͽ

ƥꡧ web

WebѴӥϤ󤢤ɡѴƽϤѥϤޤ긡ˤäʤäΤǥ⡣

OSCentOS6
OpenOfficeJODConverter򥤥󥹥ȡ롣
Τεȡ

OpenOffice.orgɥѴġȤƳѤˡ
JODConverter
OpenOfficeȤäPDF

# export DISPLAY=:1.0
# Xvfb :1 &
# Xvfb :1 -screen 0 1024x768x8
# soffice -headless -accept="socket,port=8100;urp;" -nofirststartwizard &
# netstat -anp | grep 8100
# java -jar /path/to/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar /tmp/sample.docx /tmp/sample.pdf


    Υȥ꡼ϤƤʥ֥åޡɲ

ȤȤդƤߤޤOGP

ޤǤʴǥ͡äΤ


ʤޤ


groupon-now.jp롼ݥʤˤʤäɤ͡
Ƕƥݥ󥵥ȤOGPƳϤƤơ뤹¦ȤƤǤ줷


ꤷȤˤäȥϥޤäΤǥ⡣
og:typewebsiteˤΤϥȥåץڡݤ
ʤΤǸ̤ξʥڡarticleꤷ餦ޤä

Open Graph protocol - Facebookȯˤ

Use article for any URL that represents transient content - such as a news article, blog post, photo, video, etc. Do not use website for this purpose. website and blog are designed to represent an entire site, an og:type tag with types website or blog should usually only appear on the root of a domain.


ƤȤʤΤǡ롼ݥʤǤ
ȥåץڡˤog:typewebsite
ݥܺ٤ˤog:typearticleǤ͡

    Υȥ꡼ϤƤʥ֥åޡɲ

zoomeư򥿥Ǹ

ǶΥưϤäѤzoomeǤ͡
̥礭̤礭ӥåȥ졼Ȥ⤤
˥ưήƤƤ褦˻פޤ
Ȥ櫓ǡzoomeΥPHPǡ

require_once 'XML/RPC.php';

$arr = array('tagname' => '',
             'offset' => 0,
             'length' => 10
             );
$params  = new XML_RPC_Value(array(
                                   'tagname' => new XML_RPC_Value($arr['tagname'], 'string'),
                                   'offset' => new XML_RPC_Value($arr['offset'], 'i4'),
                                   'length' => new XML_RPC_Value($arr['length'], 'i4'),
                                   ), "struct");

$msg = new XML_RPC_Message('zoome.tagSearch', array($params));
$cli = new XML_RPC_Client('/xmlrpc', 'up.zoome.jp', 80);
$res = $cli->send($msg);

if (!$res->faultCode()) {
  $data = XML_RPC_decode($res->value());
  /* "Total:". $data['count']; */
  foreach($data['list'] as $key => $val) {
    $zoome = array(
                   'zoomeid' => $val['zoomeid'],
                   'diaryid' => $val['diaryid'],
                   'title' => $val['title'],
                   'url' => $val['diaryurl'],
                   'body' => $val['body'],
                   );
  }
} else {
  exit('CODE:'.$res->faultCode(). ':'. $res->faultString());
}


ߤ򤤤ХȤۤǤ͡
ǥեȤǿȻפǤɡΥȤ餤Ϥۤʡ
¾ˤƤȤΥ᥽åɤΤǸɥȤ򻲾ȤƤߤƤ

͡zoome API(XML-RPC)ɥ
    Υȥ꡼ϤƤʥ֥åޡɲ

OpenIDǥ󤷤ơ˥å͡ϿƤ餦褦ʲ̤ǤΥХǡȥ⡣

usersơ֥nickname˥ХǡȤ򤫤


åܤ3ġ

  • ˡʥ˥å͡फ
  • ʸ⤫
  • ΤߤǤϤʤ

ΤߤϤfunction notSpaceǥå

APP/model/user.php

<?php
class User extends AppModel {
    var $name = 'User';
    var $validate = array(
        'nickname' => array(
                            'notSpace' => array(
                                                'rule' => array('notSpace'),
                                                'message' => 'ΤߤϿǤޤ'
                                                ),
                            'between' => array(
                                               'rule' => array('between', 1, 45),
                                               'message' => '1ʸʾϤƤ15ʸޤǡ'
                                               ),
                            'isUnique' => array(
                                                'rule' => 'isUnique',
                                                'message' => 'ǤϿƤޤ'
                                                ),
                            ),
        );
    function notSpace($field=array()) {
      foreach($field as $name => $value){
        if (preg_match("/^( |)+$/", $value)) {
          return false;
        } else {
          return true;
        }
      }
    }
}
?>
    Υȥ꡼ϤƤʥ֥åޡɲ

ʥ֥AtomAPIݤʤε
ϸƤäѤƱ褦˺äƤͤߤ

Ȥ櫓ǡפ֤Ĵľ
ΥȰ㤦ʬԥååס
äѤWSSEǧݥȤǤ줵̤ФȤϤʤꡣ


$nonce = sha1(md5(time()));


ʸ鲿Ǥ⤤Ȥϻפɡ


$pass_digest = base64_encode(pack('H*', sha1($nonce.$created.strtolower(md5($password)))));


դä
ʸˤ󤸤ʤʸˤ롣


Ȥgetǵη̤postURLȤäƵꤲߤ

Ѥ
³ɤ
    Υȥ꡼ϤƤʥ֥åޡɲ

ȤꤢƥȤǥХ륵ȤǺäƤߤ褦ȡ
¸ΤܤƤ륵ȡʥͥȥˤΥХǺäƤߤ

Ȥ˥ХѤ˵ǽɲäʤɤϤƤ餺
ǥ꡼ä󥭥󥰤ñ̤ˤɽ餤
PCǤZendFrameworkǺäƤ뤱ɡХǤCakePHPäƤȤʰ㤤

2010ǯ118PCȤǥХǤιΡ
1֤η¬

Х


moPV

moUU



Ʊ֤PCǡ


pcPV

pcUU



ͻ


UUߤȡΤޤޤǤPCǤ1/10餤Υ桼褽ʴ
ޡǤ⡢ΥȤ9᤯Υ桼ͥȥ򥿤ʤΤPCȤȤ⤤äƤȤ
΢̤ǥå뤳Ȥ¿
Ĥ1ΥꥢʾСˤưȤ˸Ƥäƹͤȡη̤Ǽ

褯ȥХǤPV1/231/24ȤǤ롣


פ˳ˤϽФˡȤǤäȥͥȥäƤѥ͡


ʤ󤫤ޤǹͻ˳οƤäƤʤʤʤ͡
    Υȥ꡼ϤƤʥ֥åޡɲ

äĴ٤뤳ȤäΤǡȤƻĤƤޤ

ܸtweetˡϤȤ⤦ɡ
ϥեAPIǥ桼κǿΥơ뤳Ȥ顢
ͭ̾ͤΥեtweet򽸤ʿͤФƤߤ褦ȡ

֤׳ŪˤɤΤ餤tweetʿͤȤפȤƿѤǤͤȤäƤϤ͡
ä褦ʽʤä褦ʵ뤱ɡȤꤢŬʿȤäƤߤޤ

åȤȤͭ̾ͤϾ֤
֤ΥեAPIǼʿͤޤ

äȸŤAPIλ͸Ƥpage=1Ȥǥڡꤹäƽ񤤤ƤɡΥɥȸcursorˤʤäƤ
̵̤˥ϥޤä

ͤcursor=-1ꤷơ쥹ݥ󥹤next_cursor֤äƤΤǼΥڡ򸫤ȤϤͤꤹ롣
פcursor=1,2,3Ȥʤߤ

˽񤤤ƤñʥХåäƤߤȤ
оTweet6587tweet
ȡʸ234153ʸ
ʿTweetʸ35.5ʸ
ʾΤ褦ʷ̤ˡ
*)RTǻϤޤäƤtweetϽޤ

٤äƤߤƤ30ʸäΤǡ
ܿͤ3040ʸǤĤ֤䤤ƤǤ礦֤

tweetLength.php

<?php
$username = "USERNAME";
$password = "PASSWORD";
$target = 'kazuyo_k';

$tweet=0;
$length=0;
$cursor = -1;
for ($i=0;$i<150;$i++) {
  if ($cursor == 0) break 1;

  $url = sprintf("http://twitter.com/statuses/followers.json?cursor=%d&screen_name=%s",$cursor,$target);
  $json = request($url,$username,$password);
  if (!is_array($json->users)) continue 1;
  foreach ($json->users as $key => $val) {
    if(isset($val->status)) {
      //RTǻϤޤtweetФ
      if(preg_match("/^RT(.+)/",$val->status->text)) continue 1;

      if (mb_detect_encoding($val->status->text) != 'UTF-8') continue 1;
      $tweet++;
      $length+=mb_strlen($val->status->text, 'utf-8');
    }
  }
  $cursor = $json->next_cursor;
}
echo "tweet  : " . $tweet . "\n";
echo "length : " . $length . "\n";
echo "avg    : " . $length / $tweet . "\n";

function request($host='',$username='',$password=''){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $host);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  $result = curl_exec($ch);
  curl_close($ch);

  return json_decode($result);
}
?>
    Υȥ꡼ϤƤʥ֥åޡɲ



P1000256


礦ɰۤλɤޤʤʤäܤȻפäƤΤǡ
ĤǤ˼nanapi˽񤭤ޤ
̿ϼʬǰۤλ˻äΤǤ

1ɤǤʤܤ⤢äΤǡǯɤʬ㤦褦ˤޤ

ȡ1߼ˤʤäΤǡʤäˤϤʤǤ
    Υȥ꡼ϤƤʥ֥åޡɲ


̣õȻפäƤΤǡȤꤢ񤤤Ƥߤ褦ŪʥΥäǤ
ͽ۳˸Ƥ館ƤΤǥ֥ˤĤƤޤ

ºݤΥĤˤĤƤϡnanapi

ϤäʤΤǻ̤Ǥ⡣

ʤ˥ϥޤäΤ


ƥ󥿡ͥåȤ򤷤Τ⹻塣
ļˤˤƤᤤۤäȻפޤ
ˤäƤͤï⤤ޤǤ
󥿡ͥåȤˤäΤȤСåȡBBSƥաࡣ

롼ñͥåȤïǤΤڤǥ褦ˤʤޤ
ܤϼʬʤȤФƤ餱ʤ򤷤ƤΤǡƤʤ餱Τˤʤޤ
Ƥ礦ɤΥߥ󥰤ļˤˤƥۤäƤޤ
ʥθ椬ϤޤäΤäǤ


ꥢʽ


ؼΤᤷФ餯ΥƤޤؤ夤ƤդȻפФΤ򤭤ä˺Ǯ
ˡ֤ɤˤޤǤפʹȤ񤢤뤫ƤߤʤפͶ줿Τ򤭤ä˼ºݤΥؿʽФƤޤ



褯ǯͽ֥å򾡤ȴоȤʤä櫓ʤǤ
ԹǯϥͥåȤȥꥢΥͻ礬ϤޤäǯΤ褦ʵޤ
աǤͭ̾ͤȥꥢ˽о줷̤˿Ǥޤ
ͥåȾǤζΥեϤޤǤ
ۤɸԤΥȥͥåȳǤζˤơʺäȻפޤ



餯ΤʤȤȻפǤ޶⤬Ǥ񤬳Ťޤ
ͽܤΥ˾ǹʰ̤Ȥ郎ޤ
ʤˡפǤۤܵͤޤϤ뤬ޤޡ
餱ΰΤߤä٥42ʤ˾ʡ


ʾν2001ǯޤǤΤȤǤ
ʹߥΥ줿ᡢ¤8ǯ᤯Υ֥󥯤ޤ
ľ1Ǥ⾡Ƥ뤫狼ޤ

nanapiΥ쥷Ԥ񤯤ˤꡢפ֤˥Υ˥塼䥵Ȥ򸫤ƤʤääƤΥȥ꡼񤤤Ǥ

nanapi˽񤤤Ƥʤ


񤤤ĤϡޤǤ鿴ˤȤΥĤǤ
ľʤȤǤȡΤ餤ΥĤФ餤꤬Ф䤹ʤΤǡ
աϥ󥲡Ǥ󤼤󾡤Ƥʤ󡪤ȸƤǤȤޤ



    Υȥ꡼ϤƤʥ֥åޡɲ

ʤ󤫤ΤȤʤΤǥԥѥ⡣
jQueryȤäjsonpǥǡ
Ȥꤢ饤֥ˤƻȤȤɤ߹फ󤸤ˡ

bitlyApi.js

BitlyClient = function() {
  this._initialize();
}
$.extend(BitlyClient.prototype, {
  _initialize: function(login, apikey, version) {
    this.login = login || "LOGIN";
    this.apikey = apikey || "APIKEY";
    this.version = version || "2.0.1";
  },
  shorten: function(longUrl, target) {
    var result;
    $.ajax({
      type: "GET",
      url: "http://api.bit.ly/shorten",
      data: {
        "login": this.login,
        "apiKey": this.apikey,
        "version": this.version,
        "longUrl": longUrl
      },
      dataType: "jsonp",
      success: function(data) {
        for (var r in data.results) {
          result = data.results[r];
          break;
        };
        target.text(result.shortUrl);
      }
    });
  },
  expand: function(shortUrl, target) {
    var result;
    $.ajax({
      type: "GET",
      url: "http://api.bit.ly/expand",
      data: {
        "login": this.login,
        "apiKey": this.apikey,
        "version": this.version,
        "shortUrl": shortUrl
      },
      dataType: "jsonp",
      success: function(data) {
        for (var r in data.results) {
          result = data.results[r];
          break;
        };
        target.text(result.longUrl);
      }
    });
  }
});
var Bitly = new BitlyClient();


URLȥåϤƽϤ饤֥ʤΤǻȤӤ˹碌ơ
ȤꤢURLϤƽϤ㡣

html

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script src="bitlyApi.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  $('input[id^=bitly]').click(function() {
    eval("Bitly."+$(this).val()+"($('input#url').val(), $('div#bitly-result'))");
  });
});
</script>
</head>
<body>
<input type="text" id="url" /><input type="button" value="shorten" id="bitly-shorten" /><input type="button" value="expand" id="bitly-expand" />
<div id="bitly-result"></div>

    Υȥ꡼ϤƤʥ֥åޡɲ

ƥڡˤäɤ߹jsѤȤˡ
ñʤȤɡդ˺줽ʤΤǡ

/path/to/app/webroot/js/foo.jsɤ߹ߤ硣

controller

ȥǤϥإѡθƤӽФ
<?php
class HogeController extends AppController {
  var $name = 'Hoge';
  var $helpers = array('Javascript');

  public function index() {
  }


view

ӥ塼ǤaddScript<head>˵Ҥ롣
($scripts_for_layoutʬ)
<?php $this->addScript($javascript->link('foo')); ?>

ξ˽ϤϤΤޤ
<?php echo $javascript->link('foo'); ?>

layout

쥤ȤϤȤꤢʤ󤸤$scripts_for_layout񤯡
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<?php echo $scripts_for_layout; ?>
</head>
<body>
    Υȥ꡼ϤƤʥ֥åޡɲ

ɤTwitterڤ٤
ʤˤڤΤޤ褯狼Τ
ʬǶ̣Ƥ褦APIȤäƥȺޤ
CakePHPͤơ

ECôäݤߤפ򥭡ɤ˽Ƥߤޤ

Ȥꤢ֤äѤʤߤǺäΤȤ겡ʴǤ


˾ʤ

˾ʤ

åäꡢ⤦äȥꥢ륿Ȳ¿ȻפΤǤܤܤޤ
    Υȥ꡼ϤƤʥ֥åޡɲ

livedoorBlogAtomAPI˰³֥ä㤦Ȼפäϥޤä
ƱAtomAPIƱǹԤȻפä㤦餷

Ĵ٤ƤߤWSSEǧڤȼݤ
Ǥ⤤Ĵ٤ƤƱ褦˺äƤͤϤƤ⡢褷ƤͤĤʤ

ɵݤޤ(2010-02-03)  >>εء



ޤĴ٤livedoorBlogȰ㤦Ȼפʬpass_digestκʬ

livedoorBlog
$pass_digest = base64_encode(pack('H*', sha1($nonce.$created.$password)));

֥
$pass_digest = base64_encode(pack('H*', sha1($nonce.$created.strtoupper(md5($password)))));

ѥɤmd5Ȥʸ餷Ȥξ
ǥޤۥȤ狼ޤ󡣡

֤äƤ쥹ݥ󥹤
CurlResponse Object
(
    [body] => 
X-WSSE authentication required
    [headers] => Array
        (
            [Http-Version] => 1.1
            [Status-Code] => 401
            [Status] => 401 Unauthorized
            [Set-Cookie] => BIGipServerPool_comment=3395622060.20480.0000; expires=Sat, 17-Oct-2009 01:32:13 GMT; path=/
            [Date] => Fri, 16 Oct 2009 02:18:33 GMT
            [Server] => Apache
            [Content-Length] => 83
            [Content-Type] => application/x.atom+xml
        )

)

ʤ󤫰㤦ȤǴְäƤΤ
Ѥɤϰʲ

³ɤ
    Υȥ꡼ϤƤʥ֥åޡɲ

app/vendors/shells/ʲ˥ե

/path/to/app/vendors/shells/foo.php
<?php
class FooShell extends Shell {

  var $uses = array('Hoge');

  function bar(){
    $this->args[0]; /* ޥɥ饤󤫤ΰ */
    /*  */
  }
}
?>


cronǻѤ륱¿ȻפΤǡΤ褦-appappǥ쥯ȥΥѥꡣ
/path/to/cake/console/cake foo bar -app /path/to/app/
    Υȥ꡼ϤƤʥ֥åޡɲ

ε˰³AtomAPIѡ
PHPcURLѡ

<?php
require_once 'cURL.php';

$atomapi_url = "http://cms.blog.livedoor.com/atom/";
$livedoor_id = "your livedoor id"; /* livedoorID */
$password = "your password"; /* ѥ */
$category = "1"; /* ƥ */
$title = "sample"; /* ȥ */
$text = "content"; /* ʸ */

$created = date('Y-m-d\TH:i:s\Z');
$nonce = pack('H*', sha1(md5(time())));
$pass_digest = base64_encode(pack('H*', sha1($nonce.$created.$password)));
$wsse =
  'UsernameToken Username="'.$livedoor_id.'", '.
  'PasswordDigest="'.$pass_digest.'", '.
  'Nonce="'.base64_encode($nonce).'", '.
  'Created="'.$created.'"';

$text64= base64_encode($text);

$rawdata =
  '<?xml version="1.0"?>'.
  '<entry xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">'.
  '<title type="text/html" mode="escaped">'.$title.'</title>'.
  '<dc:subject type="text/html" mode="escaped">'.$category.'</dc:subject>'.
  '<content type="application/xhtml+xml" mode="base64">'.$text64.'</content>'.
  '</entry>';

$headers = array(
              "X-WSSE" => $wsse,
              "Content-Type" => "application/x.atom+xml",
              "Cache-Control" => "no-cache",
              );

$curl = new Curl();
$curl->headers = $headers;
$curl->options = array("POSTFIELDS" => $rawdata);
$res = $curl->post($atomapi_url);
?>
    Υȥ꡼ϤƤʥ֥åޡɲ

cakePHPȤäƤߤ롣
PHPե2009εˤǤѼԤ¿äե졼
MVCΥե졼ȤäȤͤˤϤ狼䤹ǥ쥯ȥ깽

ޤǤΥĤĤ顣

ܹpost_typesơ֥ξ

ȥURL: ʣ/post_types/᥽å̾/ѥ᡼
ȥ顧 ʣPostTypesController (extends AppController)
ǥ롧 ñPostType(extends AppModel)
ӥ塼 ʣapp/views/post_types/ƥ᥽å.ctp

ǥ

  • ơ֥μ祭ϡ"id"Ȥեɤǡprimaryauto_increment ǺΤܡ
  • "ǥ̾_id"Ȥեɤǡ¾Υơ֥ǥؤγȤꡣ 㡧users ơ֥ˡ "post_id" ͡posts ơ֥ id 򻲾ȡ "post_type_id" post_types ơ֥ id 򻲾ȡ
  • "created" (DATETIME)ȤեɤǡǡȻ֤ưŪ˵Ͽ
  • "modified" (DATETIME)Ȥեɤǡǡ뤿Ӥ˻֤ưŪ˵Ͽ
  • "updated" (DATETIME)Ȥեɤǡǡ뤿Ӥ˻֤ưŪ˵Ͽ
  • "title"ȤեɤȡΥڡɸΥȥ̾ȤѤ롣
  • "name""title" Ȥեɤȡ黲Ȥ줿ˡʻ꤬ʤСˤͤ쥯ȥܥåʤɤΡ̾פȤƼưŪѤ롣(ȡgenerateList()ΰꤵƤʤˤϤΤ褦ưȤȤˤʤޤ)ɤʤСidͤǥåȹ̾ξޤʤΤνϡmodel_php4.php model_php5.php ˽񤫤Ƥޤ

ӥ塼Ϥɬפʤ᥽åɤξ

<?php
$this->autoRender = false;
?>
졢Хơ֥ɬפʤΡäƻפäƤޤä ⡣

ơ֥̤ѥǥ롢ǥ̤ѥȥ

DBѤʤǥ$useTable = false;
ǥѤʤȥ var $uses = array();ޤ var $uses = nullOK
    Υȥ꡼ϤƤʥ֥åޡɲ

TwitterAPI˸ɤꤲɽΥץ롣

ꥯȥѥ᡼ΰ㡣
ܺ٤Ϥ򻲾
q
callbackХåؿꤷȤ
langоݤθ
rpp븡̿
pageڡ


쥹ݥ󥹥ǡϤʤ󤸡
created_atȯ
from_user桼ID
profile_image_url桼Υץե
textȯ

³ƥȥץ롣
³ɤ
    Υȥ꡼ϤƤʥ֥åޡɲ

ƥӥΥɥݥȥ⡣
ȤꤢXML-RPCбƤʥ֥ΰ
ӥhostpath
FC2blog.fc2.com/xmlrpc.php
gooblog.goo.ne.jp/xmlrpc.php
seesaablog.seesaa.jp/rpc
jugenYOURID.jugem.jp/xmlrpc.php
app.f.cocolog-nifty.com/t/api
ninjaYOURID.blog.shinobi.jp/XMLRPC/


XMLRPC::Lite⥸塼ѤPerlǤμ
³ɤ
    Υȥ꡼ϤƤʥ֥åޡɲ

ȸ 21 Really Useful & Handy PHP Code Snippets
if(!emptyempty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){  
 //If AJAX Request Then  
}else{  
 //something else  
} 
    Υȥ꡼ϤƤʥ֥åޡɲ

դjsonpȤȻפä ֤ܤΥɥɲϤ­ʤ̵̤˻֤ä
˺ʤ褦˥⡣

$.ajax({
    type: "GET",
    url: "http://sample.com/",
    data: {
      "param": "hogehoge",
    },
    dataType: "jsonp",
    jsonp: "callBack",
    success: function(data) {
      /* success */
    },
    complete: function(data) {
      /* complete */
    }
});

dataTypejsonpˤjQuerycallbackѥ᡼ưƤ롣

callback=jsonp1234391216435ߤʡ

jsonpץդȢcallbackʬꤷ̾ˤǤ롣
¦APIˤäcallbackΥѥ᡼̾Ƥ礬ΤǤȤ˻Ȥ


callbackؿꤷdataץ˽񤯡

data: { "callback" : "hoge" }

callbackؿꤷʤjQueryǰʲΥɤ¹Ԥ롣
window[ 'jsonp1242391216435' ] = function(tmp){
  data = tmp;
  success();
  complete();
  // ١쥯Ƚ
  window[ jsonp ] = undefined;
  try{ delete window[ jsonp ]; } catch(e){}
  if ( head )
  head.removeChild( script );
}


¦ϤʤΤǤȤꤢǡ֤Ƥߤ
֤ǡϤˡ
<?php
$data = array("a" => "hoge", "b" => "foo", "c" => "bar");
$json = json_encode($data);
$callback = htmlspecialchars(strip_tags($_GET["callback"]));
echo $callback . "(" . $json . ")";
?>
    Υȥ꡼ϤƤʥ֥åޡɲ

ΥڡΥȥåץ