Execute a script via a URL but not from Browser

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
digital5
Forum Newbie
Posts: 9
Joined: Sat Feb 28, 2004 6:07 am
Location: Chelmsford, UK

Execute a script via a URL but not from Browser

Post by digital5 »

Have a small script that I have created which is called via a 3rd party script, it then receives some variables via HTTP POST. I then want to pass some variables via a URL back to a third party script.

I tried using the headers("Location: http://........."); which works perfectly if i call it via the browser, but my problem is that i won't be calling it via the brower.

What command do i use to send the url?
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

Hi,

You could use the file command. eg: file('http://yoururl.com?var=value');

Hope this is what you are looking for.

Greetz Laurens.
digital5
Forum Newbie
Posts: 9
Joined: Sat Feb 28, 2004 6:07 am
Location: Chelmsford, UK

Post by digital5 »

ok i tried this:-

Code: Select all

$value = "This is a test";
file('http://yoururl.com?var=$value');
And it did not work! So i tried this:-

Code: Select all

$value = "This is a test";
file("http://yoururl.com?var=$value");
And all i got back was:-

Code: Select all

This
If i try this:-

Code: Select all

$value = "This%20is a test";
file("http://yoururl.com?var=$value");
I get:-

Code: Select all

This is
How do i rectify this?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Code: Select all

$value = "This is a test"; 
file("http://yoururl.com?var=".urlencode($value));
digital5
Forum Newbie
Posts: 9
Joined: Sat Feb 28, 2004 6:07 am
Location: Chelmsford, UK

Post by digital5 »

PERFECT, many thanks to you both!
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

you're welcome..
Post Reply