Overview   Package   Tree   Index 
IMDBPHP
PREV  NEXT Frames  No Frame 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Api
Class BrowserEmulator


class BrowserEmulator

BrowserEmulator class. Provides methods for opening urls and emulating a web browser request.

Authors:
Kai Blankenhorn (kai AT bitfolge DOT de)

Method Summary
void addHeaderLine(string $name, string $value)
Add a single header field to the HTTP request header.
void addPostData(string $name, string $value)
Add a post parameter.
mixed file(string $url)
Make an file call to $url with the parameters set by previous member method calls.
mixed fopen(string $url)
Make an fopen call to $url with the parameters set by previous member method calls.
array getLastResponseHeaders()
Get the latest server response
void resetHeaderLines()
Delete all custom header lines.
void resetPort()
Reset the port used for request to the HTTP default (80).
void resetPostData()
Delete all custom post parameters.
void setAuth(string $user, string $pass)
Set an auth user and password to use for the request.
void setPort(integer $portNumber)
Select a custom port to use for the request.

Method Detail

addHeaderLine()

void addHeaderLine(string $name, string $value)

Add a single header field to the HTTP request header. The resulting header line will have the format "$name: $value\n"

Parameters:
name -
value -

addPostData()

void addPostData(string $name, string $value)

Add a post parameter. Post parameters are sent in the body of an HTTP POST request.

Parameters:
name -
value -

file()

mixed file(string $url)

Make an file call to $url with the parameters set by previous member method calls. Send all set headers, post data and user authentication data.

Parameters:
url -
Returns:
array file on success, FALSE otherwise

fopen()

mixed fopen(string $url)

Make an fopen call to $url with the parameters set by previous member method calls. Send all set headers, post data and user authentication data.

Parameters:
url -
Returns:
file handle on success, FALSE otherwise

getLastResponseHeaders()

array getLastResponseHeaders()

Get the latest server response

Returns:
lastResponse
  • 0: HTTP response (e.g. "HTTP/1.1 404 Not Found")
  • 1: Date (e.g. "Date: Sun, 08 Jun 2008 16:36:37 GMT")
  • 2: ServerInfo (e.g. "Server: Apache/2.2.3 (Ubuntu) PHP/5.2.1"
  • 3: Content length (e.g. "Content-Length: 214"
  • 4: Connection (e.g. "Connection: close")
  • 5: Content type (e.g. "Content-Type: text/html; charset=iso-8859-1")

resetHeaderLines()

void resetHeaderLines()

Delete all custom header lines. This will not remove the User-Agent header field, which is necessary for correct operation.


resetPort()

void resetPort()

Reset the port used for request to the HTTP default (80).


resetPostData()

void resetPostData()

Delete all custom post parameters.


setAuth()

void setAuth(string $user, string $pass)

Set an auth user and password to use for the request. Set both as empty strings to disable authentication.

Parameters:
user -
pass -

setPort()

void setPort(integer $portNumber)

Select a custom port to use for the request.

Parameters:
portNumber -

 Overview   Package   Tree   Index 
IMDBPHP
PREV  NEXT Frames  No Frame 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug

This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)