You are here: Passing Post variables using fopen() « PHP Programming Language « IT news, forums, messages
Passing Post variables using fopen()

Posted by Aaron on 03/21/07 12:42

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...

$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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация