sending form info to a url link using php

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
jdinze123
Forum Newbie
Posts: 3
Joined: Mon Aug 14, 2006 11:20 am

sending form info to a url link using php

Post by jdinze123 »

ok let me start off by saying that i am a noob with php.

ok, i created a form that sends the information to an online CRM tool via a URL in the actions tag. i want to use php though so i can create my own records for the form info in the form of Emails. so basically i want the form to post to php, and then the php needs to send out an email with the info and ALSO send the info to the URL. i know how to do the email part, but sending the variables to the URL is the part i dont know. i read some tutorials and examples using fopen or fsocket open but being a noob at php, i didnt understand how the variables were passed, even if thats what it was doing.

if there is a better way to do this or if anyone knows how to do this please help me.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

file_get_contents() may be easier to understand. You just create the correct url. fopen() has the same principle. There's also curl.
jdinze123
Forum Newbie
Posts: 3
Joined: Mon Aug 14, 2006 11:20 am

Post by jdinze123 »

feyd wrote:file_get_contents() may be easier to understand. You just create the correct url. fopen() has the same principle. There's also curl.
im not sure if i understand the file_get_contents() command correctly. does that creat a whole file at the url im trying to access or just the variables in the php, all i need to send is the varialbles. the online crm tool takes care of making files.

what is the exact syntax to include the varialbes i want to send. this seems like somthing really easy to do , maybe im just over analyzing it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

file_get_contents() will request the file, just like a browser would. It will return the contents of whatever is sent by the remote page. It does not generate any file by itself. You give it a full URL, just like you'd see it in a browser with name-value pairs for the variables.

http://foo.com/somePage.php?name1=value ... me3=value3 and so forth.
jdinze123
Forum Newbie
Posts: 3
Joined: Mon Aug 14, 2006 11:20 am

Post by jdinze123 »

i tried the file_get_contents() function but i got a blank screen when i hit submit. not sure if thats what its supposed to do. there has to be a better way to do this cause i have about 15 variables i have to pass to that URL. just seems silly to put them all at the end of the URL, if i can even get that to work. ugggggg. im not a php programmer and my boss is asking me to do this.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That's how GET requests are sent.. there's no way around that.
Post Reply