|
Posted by Erwin Moller on 03/21/07 13:44
Aaron@flasemi.com wrote:
> I'm trying to pull data from a website and read it into a file the I
> can parse. I've done the before to site without post variables but I
> can seem to get my statments to work with the post. Can someone help
> me out?
> below is the code I have so far. Thank in advance...
Hi,
www.php.net/curl might be just what you are looking for. ;-)
Regards,
Erwin Moller
>
> $url="www.somesitethatneedspostvariables.com";
>
> $postdata = http_build_query(
> array( 'postvarname1' => 'value1',
> 'postvarname2' => 'value2'
> )
> );
>
>
> $opts = array('http' =>
> array(
> 'method' => 'POST',
> 'header' => 'Content-type: application/x-www-form-
> urlencoded',
> 'content' => $postdata
> )
> );
>
> $context = stream_context_create($opts);
> $file = @fopen($url, "r", $content) or die("Connection Error, Please
> contact Webmaster ERROR CODE=0xDEADBEEF");
Navigation:
[Reply to this message]
|