[PHP] PHP and HTTP requests
Hi, 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? Thanks in advance Aleksei - Hot Mobiil - helinad, logod ja piltsõnumid! http://portal.hot.ee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and HTTP requests
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/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and HTTP requests
Hello Aleksei, Monday, April 19, 2004, 7:39:43 PM, you wrote: AI I realize it's a stupid question but I need a simple AI solution.. I'd like to get contence from script-generated webpage AI (I send a regquest via get or post method to a page and it AI generates a response page - how do get that page as a string? Get AI the source of the page). It's obvious that it cannot be shown with AI file functions. Only solution I was mentioned vas CURL package but AI I'd like to solve this with standard functions. Is it possible? You can perform a GET request using the standard file functions (fopen for example) because all the parameters can be passed on the Query String). However to make your life easier, and to support POST methods, just get yourself the excellent free class - Snoopy. I think the web site is just snoopy.sourceforge.net -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and HTTP requests
From: Aleksei Ivanov [EMAIL PROTECTED] 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? $page = file_get_contents('http://www.domain.com/page.php?param1=value1param2=value 2'); ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php