For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > June 2004 > How to get an parameter from a remote php script?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get an parameter from a remote php script?
Markus

2004-06-28, 8:57 pm

Okay im to stupid to figure this out.

example:
?php on http://bi.com
{
$t = "http://foo.com/boo.php?action=1&test=2";
echo $t;
}

Now on foo.com the php script boo.php
does something with this request.. So far i get it :)

Now comes the problem.

How I get the result from foo.com/boo.php into the $t ?

Any expert out where may could help me find the way around this ?

Michael Austin

2004-06-29, 3:56 am

Markus wrote:
> Okay im to stupid to figure this out.
>
> example:
> ?php on http://bi.com
> {
> $t = "http://foo.com/boo.php?action=1&test=2";
> echo $t;
> }
>
> Now on foo.com the php script boo.php
> does something with this request.. So far i get it :)
>
> Now comes the problem.
>
> How I get the result from foo.com/boo.php into the $t ?
>
> Any expert out where may could help me find the way around this ?
>


A really good bookmark/favorite is:

http://www.php.net/manual/en/index.php

and from there you can use the earch bar (near the top left) for "get
url" and find:

http://www.php.net/function.parse-url


Michael Austin.
I believe this is what you are looking for...
steve

2004-06-29, 3:56 am

Markus wrote:
> Okay im to stupid to figure this out.
>
> example:
> ?php on http://bi.com
> {
> $t = "http://foo.com/boo.php?action=1&test=2";
> echo $t;
> }
>
> Now on foo.com the php script boo.php
> does something with this request.. So far i get it
>
> Now comes the problem.
>
> How I get the result from foo.com/boo.php into the $t ?
>
> Any expert out where may could help me find the way around this ?

function URLopen($url)
{
// Fake the browser type
ini_set(’user_agent’,’MSIE 4\.0b2;’);

$dh = fopen("$url",’r’);
while (!feof($dh)) {
$result .= fread($dh,8192);
}

return $result;
}

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-paramet...pict124155.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=413680
Nikolai Chuvakhin

2004-06-29, 3:57 pm

Markus <dagger@foo.com> wrote in message
ews:<40e0baed$0$26646$5402220f@news.sunrise.ch>...
>
> ?php on http://bi.com
> {
> $t = "http://foo.com/boo.php?action=1&test=2";
> echo $t;
> }
>
> Now on foo.com the php script boo.php
> does something with this request.. So far i get it :)
>
> Now comes the problem.
>
> How I get the result from foo.com/boo.php into the $t ?


$t = file_get_contents('http://foo.com/boo.php?action=1&test=2');
echo $t;

Or, in case you don't need to store the remote file in a variable,
simply:

readfile('http://foo.com/boo.php?action=1&test=2');

Cheers,
NC
steve

2004-06-29, 3:57 pm

> Markus <dagger@foo.com> wrote in message
> ews:<40e0baed[quote:8a1089b46d="Nikolai Chuvakhin"]Markus <dagger@foo.com> wrote in message

ews:<40e0baed$0$26646$5402220f@news.sunrise.ch>...
>
> ?php on http://bi.com
> {
> $t = "http://foo.com/boo.php?action=1&test=2";
> echo $t;
> }
>
> Now on foo.com the php script boo.php
> does something with this request.. So far i get it
>
> Now comes the problem.
>
> How I get the result from foo.com/boo.php into the $t ?


$t = file_get_contents(’http://foo.com/boo.php?action=1&test=2’);
echo $t;

Or, in case you don’t need to store the remote file in a variable,
simply:

readfile(’http://foo.com/boo.php?action=1&test=2’);

Cheers,
NC[/quote:8a1089b46d]
64602220f@news.sunrise.ch>...
>
> $t = file_get_contents(’http://foo.com/boo.php?action=1&test=2’);
> echo $t;
>
> Or, in case you don’t need to store the remote file in a variable,
> simply:
>
> readfile(’http://foo.com/boo.php?action=1&test=2’);
>
> Cheers,
> NC

Nikolai, learned something new today. My approach works, but I like
yours a lot better!

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-paramet...pict124155.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=414575
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com