Des del 2000 compartiendo sobre…

HttpClient – PHP Web Client Class

Reading time: 1 – 2 minutes

Aquesta classe ens permet implementar de forma senzillissima un client HTTP 1.0 i 1.1 tan per peticions GET com POST. De fet, fa algo semblant al que que comentava de la classe de perl WWW:Mechanize tot i que amb molt menys detalls. Malgrat això pot ser molt útil per interactuar amb altres webs des del nostre codi en PHP. A més és senzillissim usar aquesta classe. HttpClient implementa les següent funcionalitats.

  • Implements a useful subset of the HTTP 1.0 and 1.1 protocols.
  • Includes cookie support.
  • Ability to set the user agent and referal fields.
  • Can automatically handle redirected pages.
  • Can be used for multiple requests, with any cookies sent by the server resent for each additional request.
  • Support for gzip encoded content, which can dramatically reduce the amount of bandwidth used in a transaction.
  • Object oriented, with static methods providing a useful shortcut for simple requests.
  • The ability to only read the page headers – useful for implementing tools such as link checkers.
  • Support for file uploads.

Per més informació recomano que mireu els exemples que hi ha a la web de la classe és realment simple d’usar.

Comments are closed.

Últimas entradas

Add a New Dropdown Menu in OpenWRT LUCI

Reading time: 3 – 5 minutes OpenWRT, the popular open-source Linux operating system designed for embedded devices, offers the LUCI interface for easy configuration and management. LUCI is essentially the web interface for OpenWRT, and while it’s already feature-rich, sometimes

Leer más »