SerjTech
asked on
php and wget
Hi all,
I have a small problem I hope you can all help me with.
I have two totally different websites located on different servers. Lets call them A and B.
What I want to happen is user goes to site A and fills in a forum. When hitting submit the form is processed, added to a database and also the php file processing the form calls a remote script hosted on website B and passes variables in the url to that form.
On site B the script is called and reads in the $_get parameters. It uses these parameters and processes them and posts output on a private forum.
Problem I am having is that the wget part and passing the variables to the script.
The $boturl is formed correctly as when I echoed it out as a test it comes out fine. When I go to folder the script is running from it shows a file that resulted from the wget has the filename: postdata.php?password=temp password and thats it. So seems when wget is pulling the file at the url it only passes the password variable and nothing else after the first &
On B's side the script only runs if password is correctly passed which it is but no other variables are being passed correctly so end results are blank/empty variables.
Am I doing something wrong?
I have a small problem I hope you can all help me with.
I have two totally different websites located on different servers. Lets call them A and B.
What I want to happen is user goes to site A and fills in a forum. When hitting submit the form is processed, added to a database and also the php file processing the form calls a remote script hosted on website B and passes variables in the url to that form.
On site B the script is called and reads in the $_get parameters. It uses these parameters and processes them and posts output on a private forum.
Problem I am having is that the wget part and passing the variables to the script.
The $boturl is formed correctly as when I echoed it out as a test it comes out fine. When I go to folder the script is running from it shows a file that resulted from the wget has the filename: postdata.php?password=temp
On B's side the script only runs if password is correctly passed which it is but no other variables are being passed correctly so end results are blank/empty variables.
Am I doing something wrong?
// Code from site A -- All variables assigned values fruther above in my code (not shown here)
$boturl = "http://example.com/script/postdata.php?password=tempassword&files=" . $files . "&size=" . $size_temp . "&name=" . $name . "&url=" . $website;
system("wget " . $boturl);
// Code from site b
$turl = isset( $_GET['url'] ) ? $_GET['url'] : '';
$password = isset( $_GET['password'] ) ? $_GET['password'] :
// etc etc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it working now.
Problem was a space in the url that script didn't like getting so used str_replace to handle the space character and it worked fine first time.
So thank you both for your answers.
Problem was a space in the url that script didn't like getting so used str_replace to handle the space character and it worked fine first time.
So thank you both for your answers.
ASKER
Warning: file_get_contents(http://example.com/script/postdata.php?password=temppass&files=6&size=3.01 MB&name=Test Filename&&url=http://siteb.com/download.php?file=test) [function.file-get-content
Line 205 is:
$x = file_get_contents($boturl)
But if I run that url in the error message via my browser the page will open and run fine processing all the information.