PHP で、HTTP クライアントを作る方法

PHP で、HTTP クライアントを作る方法をまとめてみた。以下の2通りがある。 PHP では fopen でサイトにアクセスできてしまうから、前者の方法が一番シンプルだといえるだろう。ユーザー名とパスワード付きの基本認証が施してあるサイトやさらに凝ったことをしたければ、CURL を使うのがよい。
PHP で、HTTP クライアントを作る方法をまとめてみた。以下の2通りがある。 PHP では fopen でサイトにアクセスできてしまうから、前者の方法が一番シンプルだといえるだろう。ユーザー名とパスワード付きの基本認証が施してあるサイトやさらに凝ったことをしたければ、CURL を使うのがよい。

Drupal: Develop a Minimum Function Set of Module (English)

Understanding the development of Drupal's module is also equals to understand a concept of node (content type), a hook system (callback function named 'hook'), and a form ($form).

I have already explained Drupal's hook system in "Drupal: a Minimum Set of Hooks to Develop a Module". So let me try to implement a module concretely here. The module name is 'hook'.

It is necessary to implement a module with four files such as yourmodule.info, yourmodule.install, yourmodule.module, yourmodule.css since Drupal 5. Therefore, in case of a developement of a module called 'hook', those four files must be created. This hook module includes a set of fields such as a title, a body and a unique value hid (= hook ID) with one of letters from 'A' to 'E' in this 'hook' module. A letter 'A' to 'E' to be displayed will be stored the corresponding a value from one to five in a database. The default value of hid can be set in https://yourdomain.com/admin/settings/hook. The following is an example of the 'hook' module.

Understanding the development of Drupal's module is also equals to understand a concept of node (content type), a hook system (callback function named 'hook'), and a form ($form).

I have already explained Drupal's hook system in "Drupal: a Minimum Set of Hooks to Develop a Module". So let me try to implement a module concretely here. The module name is 'hook'.

It is necessary to implement a module with four files such as yourmodule.info, yourmodule.install, yourmodule.module, yourmodule.css since Drupal 5. Therefore, in case of a developement of a module called 'hook', those four files must be created. This hook module includes a set of fields such as a title, a body and a unique value hid (= hook ID) with one of letters from 'A' to 'E' in this 'hook' module. A letter 'A' to 'E' to be displayed will be stored the corresponding a value from one to five in a database. The default value of hid can be set in https://yourdomain.com/admin/settings/hook. The following is an example of the 'hook' module.

Requirements for Mobile Phones (English)

I would like to propose the unique requirements for mobile phones. The following items are significant considerations under mobile site development, especially in i-mode phones.
  1. UserAgent type that is, a Browser Name of CGI environments which is sent by a mobile phone to a web server.
  2. Range of IP addresses in each mobile operator, which is required to judge whether a user is using a mobile phone or a PC in order to support both of them in the web site. In Japanese mobile phone operators, they are using their specific proxy servers, which are accompanying with the specific range of IP addresses.
  3. Screen Size of each mobile phone, especially the size of width, which would be found in a CGI environment UserAgent in the latest phones
  4. Image Format such as JPEG, PNG and GIF supported by each mobile phone
  5. Maximum Size of Receiving Bytes per a page
  6. Difference of Handling Colors in each mobile phone
  7. Difference of Smilies (Picture Icons) both in each mobile phone and operator
  8. Name Convention of an E-mail Address in each operator (Japanese i-mode e-mail system violates RFC).
  9. Available Character Set in each operator (Shift-JIS, UTF-8 in Japan)
  10. Available Character Types in each operator (such as ZENKAKU, HANKAKU in Japan)
  11. Available Input Method in each operator (Access-key concept in CHTML)
  12. Support of Native Functions of a mobile phone (i.e. switching a browser screen to an e-mail application with 'mailto:' in CHTML at a single screen of a mobile phone, launching Java application, and directly calling to someone with 'tel:' in CHTML, etc)
  13. Difference in between Official Sites and Unofficial Sites (The acquiring information is different)
  14. Session Management because we cannot use cookie in i-mode phones
I would like to propose the unique requirements for mobile phones. The following items are significant considerations under mobile site development, especially in i-mode phones.
  1. UserAgent type that is, a Browser Name of CGI environments which is sent by a mobile phone to a web server.
  2. Range of IP addresses in each mobile operator, which is required to judge whether a user is using a mobile phone or a PC in order to support both of them in the web site. In Japanese mobile phone operators, they are using their specific proxy servers, which are accompanying with the specific range of IP addresses.
  3. Screen Size of each mobile phone, especially the size of width, which would be found in a CGI environment UserAgent in the latest phones
  4. Image Format such as JPEG, PNG and GIF supported by each mobile phone
  5. Maximum Size of Receiving Bytes per a page
  6. Difference of Handling Colors in each mobile phone
  7. Difference of Smilies (Picture Icons) both in each mobile phone and operator
  8. Name Convention of an E-mail Address in each operator (Japanese i-mode e-mail system violates RFC).
  9. Available Character Set in each operator (Shift-JIS, UTF-8 in Japan)
  10. Available Character Types in each operator (such as ZENKAKU, HANKAKU in Japan)
  11. Available Input Method in each operator (Access-key concept in CHTML)
  12. Support of Native Functions of a mobile phone (i.e. switching a browser screen to an e-mail application with 'mailto:' in CHTML at a single screen of a mobile phone, launching Java application, and directly calling to someone with 'tel:' in CHTML, etc)
  13. Difference in between Official Sites and Unofficial Sites (The acquiring information is different)
  14. Session Management because we cannot use cookie in i-mode phones

Drupal で、モジュール固有の設定値を使うには?(variable_get)

Drupal で、自分の作ったモジュールで設定画面を出して各種パラメータなど固有の値の設定をさせたい場合があるだろう。ここでは「hook」というモジュールを例に考えてみよう。設定画面を https://yourdomain.com/admin/settings/hook/ にアクセスしたときに表示させたい場合には、以下のようにする(「hook」とあるところは、「yourmodulename」となるので、適宜置換すること)。
Drupal で、自分の作ったモジュールで設定画面を出して各種パラメータなど固有の値の設定をさせたい場合があるだろう。ここでは「hook」というモジュールを例に考えてみよう。設定画面を https://yourdomain.com/admin/settings/hook/ にアクセスしたときに表示させたい場合には、以下のようにする(「hook」とあるところは、「yourmodulename」となるので、適宜置換すること)。