কম্পিউটার টিউটোরিয়াল

PHP http:// র‍্যাপার


ভূমিকা

https:// এবং https:// র‍্যাপার HTTP প্রোটোকল দিয়ে রিসোর্স ও ফাইলে রিড-অনলি এক্সেস সক্ষম করে। ভার্চুয়াল নেম-বেসড হোস্ট হ্যান্ডল করার সময় host: হেডারও user_agent (যদি php.ini-এ কনফিগার করা থাকে) সহ পাঠানো হয়।

HTTP হেডার ইনফো $http_response_header ভেরিয়েবলে সংরক্ষিত থাকে। এই হেডারগুলো প্রসেস করে from: হেডারের সাহায্যে ডকুমেন্ট কোন রিসোর্স URL থেকে এসেছে তা জানা যায়।

HTTPS শুধু তখন সাপোর্ট করা হয় যখন openssl এক্সটেনশন php.ini-এ ইনেবলড থাকে। HTTP এবং HTTPS কানেকশন দুটোই রিড-অনলি এবং ফাইল রাইট বা কপি সাপোর্ট করে না।

ব্যবহার

ফাইল নামের বিভিন্ন সম্ভাব্য রিপ্রেজেন্টেশন—

https://localhost https://example.com https://localhost?name='Ram'&age=20 https://example.com https://username:password@abc.com

উদাহরণ

<?php $url = 'https://www.tutorialspoint.com/php7/php7_closure_call.htm'; if (!$fp = fopen($url, 'r')) { trigger_error("Unable to open URL ($url)", E_USER_ERROR); } $meta = stream_get_meta_data($fp); print_r($meta); ?>

উপরের স্ক্রিপ্ট HTTP URL থেকে হেডার মেটাডেটা পড়ে।

Array( [crypto] => Array( [protocol] => TLSv1.2 [cipher_name] => ECDHE-RSA-AES128-GCM-SHA256 [cipher_bits] => 128 [cipher_version] => TLSv1/SSLv3 ) [timed_out] => [blocked] => 1 [eof] => [wrapper_data] => Array( [0] => HTTP/1.0 200 OK [1] => Age: 1310067 [2] => Cache-Control: max-age=2592000 [3] => Content-Type: text/html; charset=UTF-8 [4] => Date: Mon, 14 Sep 2020 17:15:36 GMT [5] => Expires: Wed, 14 Oct 2020 17:15:36 GMT [6] => Last-Modified: Sun, 30 Aug 2020 13:21:09 GMT [7] => Server: ECS (nag/99AA) [8] => Strict-Transport-Security: max-age=63072000; includeSubdomains [9] => Vary: Accept-Encoding [10] => X-Cache: HIT [11] => X-Content-Type-Options: nosniff [12] => X-Frame-Options: SAMEORIGIN [13] => X-XSS-Protection: 1; mode=block [14] => Content-Length: 24102 [15] => Connection: close ) [wrapper_type] => http [stream_type] => tcp_socket/ssl [mode] => r [unread_bytes] => 0 [seekable] => [uri] => https://www.tutorialspoint.com/php7/php7_closure_call.htm )

  1. PHP HTTP কনটেক্সট অপশনস

  2. PHP ট্যাগস (PHP Tags)

  3. PHP pi() ফাংশন

  4. PHP-এ XML ফাইল ইচো করা