l_l asks
17 years ago
how can I send a POST request to another website using PHP? And make it into a link someone can click?
latest #19
l_l
17 years ago
And how can I make that activate when someone clicks on a link?
Chris
17 years ago
Have the link go to the PHP file that has that in it. If you want it to happen when someone clicks a link without loading a new page, then..
立即下載
l_l
17 years ago
I'm guessing it something similar to this Proxy form submit, but I'm not sure how it works. pastie.org/225177
Chris
17 years ago
... use Javascript.
l_l
17 years ago
Oh, yeah, and that brings up another question. I see that you use single quotes instead of double quotes inside the page() funtion
l_l
17 years ago
But what do you do to represent single quotes, like in javascript?
Chris
17 years ago
Do you mean nesting quotes? Use backslashes. " \"quoted text\" "
l_l
17 years ago
So, would I structure this function like index.php or like class.redirect.php?
Chris
17 years ago
What exactly are you trying to do?
l_l
17 years ago
Just what you told me to do. But it looks like, from http_post_data, that I'm going to have to have a function that receives variables.
l_l
17 years ago
How would I PHP file I can send data to?
Chris
17 years ago
No, I mean, what are you trying to do with this PHP file? It doesn't have to be extremely complicated to accept POST data.
l_l
17 years ago
You know the twitter link? I want to do that, but for Plurk. And I can only do that with POST data
Chris
17 years ago
Then what does PHP have to do with anything? You can do that with AJAX.
l_l
17 years ago
Oh...
l_l
17 years ago
Something like this? www.hunlock.com/blogs/AJ...
l_l
17 years ago
Alright, so I put that code in a plurk() function inside script tags, and then called that with onClick in the <a> tag.
l_l
17 years ago
But, still not working. Is there anything wrong with that function or the way I did it?
back to top