PDA

View Full Version : Simple fpassthru with POST


Ricky158
03-28-2008, 08:08 PM
This file is called proxy.php and I want to call it like this: proxy.php?crn=10711

Here is the file:

<?php
$crn = ($_POST["crn"]);
$file = fopen("https://buonline.binghamton.edu/banner/bwckschd.p_disp_detail_sched?term_in=200890&crn_in="+$crn,"r");
fpassthru($file);
?>

I'm getting

Warning: fopen(0) [function.fopen]: failed to open stream: No such file or directory
Warning: fpassthru(): supplied argument is not a valid stream resource

How can I fix this?

tagnu
03-28-2008, 08:43 PM
hi,
check if you have

allow_url_fopen = On

in your php.ini file

link to the article (http://www.mydigitallife.info/2006/04/21/php-5-unable-to-open-http-request-stream-with-fopen-or-fsockopen-functions/)

Ricky158
03-29-2008, 12:24 AM
i figured out what was wrong.

1. should use "GET" instead of "POST"
2. to concatenate strings use dot " . " instead of plus " + "