make http request to another url...
Posted: Sat Dec 12, 2009 8:19 am
hi,
totally new to php. Need to know how to download a web page via php, and display the response onto the screen. I've tried the following thread, but it didn't work...
viewtopic.php?f=1&t=104054&p=556715
Here is my php code:
Basically tried everything in there...Running php of LAMP...
totally new to php. Need to know how to download a web page via php, and display the response onto the screen. I've tried the following thread, but it didn't work...
viewtopic.php?f=1&t=104054&p=556715
Here is my php code:
Code: Select all
<?php
/*
$handle = fopen("http://www.example.com","r");
$txt = fread($handle, "15");
echo $txt;
fclose($handle);
*/
#$response = http_get("http://www.example.com/", array("timeout"=>1), $info);
#$response = http_request(0,"www.example.com");
//print_r($info);
//print_r($response);
//echo $response;
#echo "this is the end";
echo "hello world"
echo 'test';
$r = new HttpRequest('http://example.com/form.php', HttpRequest::METH_POST);
echo 'test';
$r->setOptions(array('cookies' => array('lang' => 'de')));
$r->addPostFields(array('user' => 'mike', 'pass' => 's3c|r3t'));
try
{
echo $r->send()->getBody();
}
catch (HttpException $ex) { echo $ex; }
?>