Re: PHP and HTTP requests

From: Date: Mon, 19 Apr 2004 18:46:46 +0000
Subject: Re: PHP and HTTP requests
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-183840@lists.php.net to get a copy of this message
> I realize it's a stupid question but I need a simple solution.. I'd like > to get contence from script-generated webpage (I send a regquest via get > or post method to a page and it generates a response page - how do get > that page as a string? Get the source of the page). It's obvious that it > cannot be shown with file functions. Only solution I was mentioned vas > CURL package but I'd like to solve this with standard functions. Is it > possible? fopen() can support streams, if your configuration allows it: http://php.net/manual/en/function.fopen.php Alternatively, you can use the socket functions to hand-roll an HTTP request, in the event that you need stricter control over POST contents or specific headers. http://php.net/manual/en/ref.sockets.php Or, if you're on a unix system, and curl's available as an executable, and you consider exec to be a "standard" function, there's always this: $response = shell_exec("curl http://www.example.com"); I always use last method that in preference to the curl functions. I find them incredibly overengineered. :) --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html

« previous php.general (#183840) next »