HTTP POST from PHP using a link
HTTP POST from PHP using a link
am 14.01.2008 22:57:26 von trpost
I am looking for a way to send data from one page to another as POST
data without using forms or cURL.
I have a php script that is passing a list of cases from on page to
another when a link is clicked. This is working fine for the most part
as a link, but sometimes the list gets very large and gets cut off.
The reason it gets cut off appears to be a limitation on the amount of
data that can be passesd in the URI.
It looks like I can do this with cURL, but this script will run on
several servers that do not have cURL compiled in and I do not want to
recompile now.
I found a few posts that say this can be done with PHP and javascript,
but I found no good examples.
To give you an example on what I am doing:
$count
$allCases is a comma separated list of numbers and can get very large.
i.e. 84638,48957,58945,45375,....
Thanks!
Re: HTTP POST from PHP using a link
am 14.01.2008 23:32:39 von luiheidsgoeroe
On Mon, 14 Jan 2008 22:57:26 +0100, wrote:
> I am looking for a way to send data from one page to another as POST
> data without using forms or cURL.
>
> I have a php script that is passing a list of cases from on page to
> another when a link is clicked. This is working fine for the most part=
> as a link, but sometimes the list gets very large and gets cut off.
> The reason it gets cut off appears to be a limitation on the amount of=
> data that can be passesd in the URI.
>
> It looks like I can do this with cURL, but this script will run on
> several servers that do not have cURL compiled in and I do not want to=
> recompile now.
>
> I found a few posts that say this can be done with PHP and javascript,=
> but I found no good examples.
>
> To give you an example on what I am doing:
>
ll>
> $count
>
> $allCases is a comma separated list of numbers and can get very large.=
> i.e. 84638,48957,58945,45375,....
While you could 'cheat' by firing a XMLHTTPRequest which actually posts =
=
with javascript, this would not be very reliable, and for about 5%-15% o=
f =
the people just plain won't work.
As stated numerous times the last few weeks: you probably want to save t=
he =
data in a session. No posting/getting necessary, you allready have the =
data ready on your server.
However: can you tell why it is your link couldn't be a button that post=
s =
a form? Never make it harder on yourself then should be...
-- =
Rik Wasmus
Re: HTTP POST from PHP using a link
am 14.01.2008 23:33:03 von Paul Lautman
trpost@gmail.com wrote:
>I am looking for a way to send data from one page to another as POST
> data without using forms or cURL.
>
> I have a php script that is passing a list of cases from on page to
> another when a link is clicked. This is working fine for the most part
> as a link, but sometimes the list gets very large and gets cut off.
> The reason it gets cut off appears to be a limitation on the amount of
> data that can be passesd in the URI.
>
> It looks like I can do this with cURL, but this script will run on
> several servers that do not have cURL compiled in and I do not want to
> recompile now.
>
> I found a few posts that say this can be done with PHP and javascript,
> but I found no good examples.
>
> To give you an example on what I am doing:
>
> $count
>
> $allCases is a comma separated list of numbers and can get very large.
> i.e. 84638,48957,58945,45375,....
>
> Thanks!
If you do it with php and javacript you are in effect using a form, which
you have stated you do not want to do.
Re: HTTP POST from PHP using a link
am 14.01.2008 23:41:32 von Daniel Ennis
trpost@gmail.com wrote:
> I am looking for a way to send data from one page to another as POST
> data without using forms or cURL.
>
> I have a php script that is passing a list of cases from on page to
> another when a link is clicked. This is working fine for the most part
> as a link, but sometimes the list gets very large and gets cut off.
> The reason it gets cut off appears to be a limitation on the amount of
> data that can be passesd in the URI.
>
> It looks like I can do this with cURL, but this script will run on
> several servers that do not have cURL compiled in and I do not want to
> recompile now.
>
> I found a few posts that say this can be done with PHP and javascript,
> but I found no good examples.
>
> To give you an example on what I am doing:
>
> $count
>
> $allCases is a comma separated list of numbers and can get very large.
> i.e. 84638,48957,58945,45375,....
>
> Thanks!
Your talking about cURL but also talking about doing it in links? Kinda
confused.
If the data is large, it should be in a database or stored in session.
If your just wanting to submit that data to another site then display
results, you can also use sockets and do a manual HTTP request with the
POST data.
The biggest question is why send so much data and not use a form?
--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel@fanetworks.net
Re: HTTP POST from PHP using a link
am 14.01.2008 23:45:45 von trpost
On Jan 14, 3:33=A0pm, "Paul Lautman"
wrote:
> trp...@gmail.com wrote:
> >I am looking for a way to send data from one page to another as POST
> > data without using forms or cURL.
>
> > I have a php script that is passing a list of cases from on page to
> > another when a link is clicked. This is working fine for the most part
> > as a link, but sometimes the list gets very large and gets cut off.
> > The reason it gets cut off appears to be a limitation on the amount of
> > data that can be passesd in the URI.
>
> > It looks like I can do this with cURL, but this script will run on
> > several servers that do not have cURL compiled in and I do not want to
> > recompile now.
>
> > I found a few posts that say this can be done with PHP and javascript,
> > but I found no good examples.
>
> > To give you an example on what I am doing:
> >
>
> > $count
>
> > $allCases is a comma separated list of numbers and can get very large.
> > i.e. 84638,48957,58945,45375,....
>
> > Thanks!
>
> If you do it with php and javacript you are in effect using a form, which
> you have stated you do not want to do.- Hide quoted text -
>
> - Show quoted text -
Well I guess I don't mind using a form, but I have a few hundred links
on the page and didn't think it would be efficient to create a hidden
field for each potential link. I instead just want to send the data
that is clicked on. For example here is how you use the applciation:
Name Low Med. High
Test 100 980 203
Test1 433 656 135
Test2 118 313 733
Test3 952 416 518
Test4 205 813 465
Test5 425 556 324
Test6 113 131 943
Test7 291 767 304
...
This goes on for a few hundred rows.... You can currently click on any
number, which passes a list of underlying numbers to another .php
script which gives you more details. So if you click on 100, it goes
to another script passing a comma separated list of 100 cases.
Re: HTTP POST from PHP using a link
am 14.01.2008 23:55:14 von Manuel Lemos
Hello,
on 01/14/2008 07:57 PM trpost@gmail.com said the following:
> I am looking for a way to send data from one page to another as POST
> data without using forms or cURL.
>
> I have a php script that is passing a list of cases from on page to
> another when a link is clicked. This is working fine for the most part
> as a link, but sometimes the list gets very large and gets cut off.
> The reason it gets cut off appears to be a limitation on the amount of
> data that can be passesd in the URI.
>
> It looks like I can do this with cURL, but this script will run on
> several servers that do not have cURL compiled in and I do not want to
> recompile now.
>
> I found a few posts that say this can be done with PHP and javascript,
> but I found no good examples.
>
> To give you an example on what I am doing:
>
> $count
>
> $allCases is a comma separated list of numbers and can get very large.
> i.e. 84638,48957,58945,45375,....
You can try this HTTP client class. It can perform arbitrary HTTP
requests without using Curl:
http://www.phpclasses.org/httpclient
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Re: HTTP POST from PHP using a link
am 15.01.2008 02:39:00 von trpost
On Jan 14, 3:55=A0pm, Manuel Lemos wrote:
> Hello,
>
> on 01/14/2008 07:57 PM trp...@gmail.com said the following:
>
>
>
>
>
> > I am looking for a way to send data from one page to another as POST
> > data without using forms or cURL.
>
> > I have a php script that is passing a list of cases from on page to
> > another when a link is clicked. This is working fine for the most part
> > as a link, but sometimes the list gets very large and gets cut off.
> > The reason it gets cut off appears to be a limitation on the amount of
> > data that can be passesd in the URI.
>
> > It looks like I can do this with cURL, but this script will run on
> > several servers that do not have cURL compiled in and I do not want to
> > recompile now.
>
> > I found a few posts that say this can be done with PHP and javascript,
> > but I found no good examples.
>
> > To give you an example on what I am doing:
> >
>
> > $count
>
> > $allCases is a comma separated list of numbers and can get very large.
> > i.e. 84638,48957,58945,45375,....
>
> You can try this HTTP client class. It can perform arbitrary HTTP
> requests without using Curl:
>
> http://www.phpclasses.org/httpclient
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP professionals looking for PHP jobshttp://www.phpclasses.org/profession=
als/
>
> PHP Classes - Free ready to use OOP components written in PHPhttp://www.ph=
pclasses.org/- Hide quoted text -
>
> - Show quoted text -
I tried the Class and it looks to be able to send POST data to a page
and request back the results. I am looking to actually goto the page
as if you had clicked on the link. I basically created an app that
sometimes tries to send data to a page that exceeds the max length
allowed in the URL. What are options for getting around that limit. I
could see using a form if I had just one link, but I have hundreds and
can't think of a way to just send the data from the link I click on if
I used a form.
Re: HTTP POST from PHP using a link
am 15.01.2008 02:51:08 von Jerry Stuckle
trpost@gmail.com wrote:
> On Jan 14, 3:55 pm, Manuel Lemos wrote:
>> Hello,
>>
>> on 01/14/2008 07:57 PM trp...@gmail.com said the following:
>>
>>
>>
>>
>>
>>> I am looking for a way to send data from one page to another as POST
>>> data without using forms or cURL.
>>> I have a php script that is passing a list of cases from on page to
>>> another when a link is clicked. This is working fine for the most part
>>> as a link, but sometimes the list gets very large and gets cut off.
>>> The reason it gets cut off appears to be a limitation on the amount of
>>> data that can be passesd in the URI.
>>> It looks like I can do this with cURL, but this script will run on
>>> several servers that do not have cURL compiled in and I do not want to
>>> recompile now.
>>> I found a few posts that say this can be done with PHP and javascript,
>>> but I found no good examples.
>>> To give you an example on what I am doing:
>>>
>>> $count
>>> $allCases is a comma separated list of numbers and can get very large.
>>> i.e. 84638,48957,58945,45375,....
>> You can try this HTTP client class. It can perform arbitrary HTTP
>> requests without using Curl:
>>
>> http://www.phpclasses.org/httpclient
>>
>> --
>>
>> Regards,
>> Manuel Lemos
>>
>> PHP professionals looking for PHP jobshttp://www.phpclasses.org/professionals/
>>
>> PHP Classes - Free ready to use OOP components written in PHPhttp://www.phpclasses.org/- Hide quoted text -
>>
>> - Show quoted text -
>
> I tried the Class and it looks to be able to send POST data to a page
> and request back the results. I am looking to actually goto the page
> as if you had clicked on the link. I basically created an app that
> sometimes tries to send data to a page that exceeds the max length
> allowed in the URL. What are options for getting around that limit. I
> could see using a form if I had just one link, but I have hundreds and
> can't think of a way to just send the data from the link I click on if
> I used a form.
>
Where did the data come from in the first place? A database maybe? If
so, just send the key back and query the database again.
Or have a separate form for each row.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
=================
Re: HTTP POST from PHP using a link
am 15.01.2008 06:03:22 von Manuel Lemos
Hello,
on 01/14/2008 11:39 PM trpost@gmail.com said the following:
>>> I am looking for a way to send data from one page to another as POST
>>> data without using forms or cURL.
>>> I have a php script that is passing a list of cases from on page to
>>> another when a link is clicked. This is working fine for the most part
>>> as a link, but sometimes the list gets very large and gets cut off.
>>> The reason it gets cut off appears to be a limitation on the amount of
>>> data that can be passesd in the URI.
>>> It looks like I can do this with cURL, but this script will run on
>>> several servers that do not have cURL compiled in and I do not want to
>>> recompile now.
>>> I found a few posts that say this can be done with PHP and javascript,
>>> but I found no good examples.
>>> To give you an example on what I am doing:
>>>
>>> $count
>>> $allCases is a comma separated list of numbers and can get very large.
>>> i.e. 84638,48957,58945,45375,....
>> You can try this HTTP client class. It can perform arbitrary HTTP
>> requests without using Curl:
>>
>> http://www.phpclasses.org/httpclient
>
> I tried the Class and it looks to be able to send POST data to a page
> and request back the results. I am looking to actually goto the page
> as if you had clicked on the link. I basically created an app that
> sometimes tries to send data to a page that exceeds the max length
> allowed in the URL. What are options for getting around that limit. I
> could see using a form if I had just one link, but I have hundreds and
> can't think of a way to just send the data from the link I click on if
> I used a form.
I think the limit is in the browsers, something like 255 characters. So
I think you can submit a GET request using that class to an URL without
that limit.
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Re: HTTP POST from PHP using a link
am 15.01.2008 09:48:08 von Daniel Ennis
trpost@gmail.com wrote:
> On Jan 14, 3:55 pm, Manuel Lemos wrote:
>> Hello,
>>
>> on 01/14/2008 07:57 PM trp...@gmail.com said the following:
>>
>>
>>
>>
>>
>>> I am looking for a way to send data from one page to another as POST
>>> data without using forms or cURL.
>>> I have a php script that is passing a list of cases from on page to
>>> another when a link is clicked. This is working fine for the most part
>>> as a link, but sometimes the list gets very large and gets cut off.
>>> The reason it gets cut off appears to be a limitation on the amount of
>>> data that can be passesd in the URI.
>>> It looks like I can do this with cURL, but this script will run on
>>> several servers that do not have cURL compiled in and I do not want to
>>> recompile now.
>>> I found a few posts that say this can be done with PHP and javascript,
>>> but I found no good examples.
>>> To give you an example on what I am doing:
>>>
>>> $count
>>> $allCases is a comma separated list of numbers and can get very large.
>>> i.e. 84638,48957,58945,45375,....
>> You can try this HTTP client class. It can perform arbitrary HTTP
>> requests without using Curl:
>>
>> http://www.phpclasses.org/httpclient
>>
>> --
>>
>> Regards,
>> Manuel Lemos
>>
>> PHP professionals looking for PHP jobshttp://www.phpclasses.org/professionals/
>>
>> PHP Classes - Free ready to use OOP components written in PHPhttp://www.phpclasses.org/- Hide quoted text -
>>
>> - Show quoted text -
>
> I tried the Class and it looks to be able to send POST data to a page
> and request back the results. I am looking to actually goto the page
> as if you had clicked on the link. I basically created an app that
> sometimes tries to send data to a page that exceeds the max length
> allowed in the URL. What are options for getting around that limit. I
> could see using a form if I had just one link, but I have hundreds and
> can't think of a way to just send the data from the link I click on if
> I used a form.
Then what your asking to do is totally client side and has nothing to do
with PHP. Try c.l.js.
If its not doable in JS, then you need to use a form. But honestly what
your doing is very weird, and unless this is going across different
domains, is NOT the proper solution for what your trying to do.
The only reason you should ever be doing what your trying to do is if
your sending data from like domaina.com to domainb.com where cookies and
sessions wont persist.
If your sending this from mysite.com/page1.php to mysite.com/page2.php,
seriously reconsider your design of this code and change it to be passed
by session, database key, something to retrieve the data on the next
page and not send it between POST or GET.
--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel@fanetworks.net
Re: HTTP POST from PHP using a link
am 15.01.2008 12:17:21 von Michael Fesser
..oO(Manuel Lemos)
>on 01/14/2008 11:39 PM trpost@gmail.com said the following:
>>
>> I tried the Class and it looks to be able to send POST data to a page
>> and request back the results. I am looking to actually goto the page
>> as if you had clicked on the link. I basically created an app that
>> sometimes tries to send data to a page that exceeds the max length
>> allowed in the URL. What are options for getting around that limit. I
>> could see using a form if I had just one link, but I have hundreds and
>> can't think of a way to just send the data from the link I click on if
>> I used a form.
>
>I think the limit is in the browsers, something like 255 characters. So
>I think you can submit a GET request using that class to an URL without
>that limit.
There are also buffer limits in the web servers. For sending large
amounts of data to a script POST is the correct way.
Micha
Re: HTTP POST from PHP using a link
am 15.01.2008 12:44:24 von Jerry Stuckle
Daniel Ennis wrote:
> trpost@gmail.com wrote:
>> On Jan 14, 3:55 pm, Manuel Lemos wrote:
>>> Hello,
>>>
>>> on 01/14/2008 07:57 PM trp...@gmail.com said the following:
>>>
>>>
>>>
>>>
>>>
>>>> I am looking for a way to send data from one page to another as POST
>>>> data without using forms or cURL.
>>>> I have a php script that is passing a list of cases from on page to
>>>> another when a link is clicked. This is working fine for the most part
>>>> as a link, but sometimes the list gets very large and gets cut off.
>>>> The reason it gets cut off appears to be a limitation on the amount of
>>>> data that can be passesd in the URI.
>>>> It looks like I can do this with cURL, but this script will run on
>>>> several servers that do not have cURL compiled in and I do not want to
>>>> recompile now.
>>>> I found a few posts that say this can be done with PHP and javascript,
>>>> but I found no good examples.
>>>> To give you an example on what I am doing:
>>>>
>>>> $count
>>>> $allCases is a comma separated list of numbers and can get very large.
>>>> i.e. 84638,48957,58945,45375,....
>>> You can try this HTTP client class. It can perform arbitrary HTTP
>>> requests without using Curl:
>>>
>>> http://www.phpclasses.org/httpclient
>>>
>>> --
>>>
>>> Regards,
>>> Manuel Lemos
>>>
>>> PHP professionals looking for PHP
>>> jobshttp://www.phpclasses.org/professionals/
>>>
>>> PHP Classes - Free ready to use OOP components written in
>>> PHPhttp://www.phpclasses.org/- Hide quoted text -
>>>
>>> - Show quoted text -
>>
>> I tried the Class and it looks to be able to send POST data to a page
>> and request back the results. I am looking to actually goto the page
>> as if you had clicked on the link. I basically created an app that
>> sometimes tries to send data to a page that exceeds the max length
>> allowed in the URL. What are options for getting around that limit. I
>> could see using a form if I had just one link, but I have hundreds and
>> can't think of a way to just send the data from the link I click on if
>> I used a form.
>
> Then what your asking to do is totally client side and has nothing to do
> with PHP. Try c.l.js.
>
> If its not doable in JS, then you need to use a form. But honestly what
> your doing is very weird, and unless this is going across different
> domains, is NOT the proper solution for what your trying to do.
>
> The only reason you should ever be doing what your trying to do is if
> your sending data from like domaina.com to domainb.com where cookies and
> sessions wont persist.
>
> If your sending this from mysite.com/page1.php to mysite.com/page2.php,
> seriously reconsider your design of this code and change it to be passed
> by session, database key, something to retrieve the data on the next
> page and not send it between POST or GET.
>
It's not good to save large amounts of data in the session - it can be
quite slow.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: HTTP POST from PHP using a link
am 15.01.2008 14:26:13 von Courtney
Michael Fesser wrote:
> .oO(Manuel Lemos)
>
>> on 01/14/2008 11:39 PM trpost@gmail.com said the following:
>>> I tried the Class and it looks to be able to send POST data to a page
>>> and request back the results. I am looking to actually goto the page
>>> as if you had clicked on the link. I basically created an app that
>>> sometimes tries to send data to a page that exceeds the max length
>>> allowed in the URL. What are options for getting around that limit. I
>>> could see using a form if I had just one link, but I have hundreds and
>>> can't think of a way to just send the data from the link I click on if
>>> I used a form.
>> I think the limit is in the browsers, something like 255 characters. So
>> I think you can submit a GET request using that class to an URL without
>> that limit.
>
> There are also buffer limits in the web servers. For sending large
> amounts of data to a script POST is the correct way.
>
> Micha
You can do this with javascript.
Essentially use the onclick() stuff to poke the right data into a HIDDEN
variable, and POST that to the form
So you have somewhere
and a javascript..
Syntax is guaranteed to be wrong, but thats the principle
Re: HTTP POST from PHP using a link
am 15.01.2008 17:15:45 von Michael Fesser
..oO(The Natural Philosopher)
>Michael Fesser wrote:
>>
>> There are also buffer limits in the web servers. For sending large
>> amounts of data to a script POST is the correct way.
>
>You can do this with javascript.
Sure, if it doesn't have to be reliable ...
Micha
Re: HTTP POST from PHP using a link
am 15.01.2008 20:12:50 von Courtney
Michael Fesser wrote:
> .oO(The Natural Philosopher)
>
>> Michael Fesser wrote:
>>> There are also buffer limits in the web servers. For sending large
>>> amounts of data to a script POST is the correct way.
>> You can do this with javascript.
>
> Sure, if it doesn't have to be reliable ...
>
Javascript is *pretty* reliable on *simple* things.
If the site doesn't work on I-phones, who cares ;-)
I don't WANT i-phone customers using my sites anyway. Spawn of the devil
etc.
> Micha
Re: HTTP POST from PHP using a link
am 16.01.2008 02:00:00 von trpost
This is exactly what I needed, just a way to dynamically submit POST
data based on a link clicked. Thanks for all for contributing, code
below is adapted from (The Natural Philosopher) above.
a.php:
b.php:
echo "";
var_dump($_POST);
echo "
";
?>
Re: HTTP POST from PHP using a link
am 16.01.2008 03:46:03 von Courtney
trpost@gmail.com wrote:
> This is exactly what I needed, just a way to dynamically submit POST
> data based on a link clicked. Thanks for all for contributing, code
> below is adapted from (The Natural Philosopher) above.
>
>
> a.php:
>
>
>
>
>
>
>
> b.php:
>
>
> echo "";
> var_dump($_POST);
> echo "
";
>
> ?>
Bice of you to debug it..DO test it against ALL browsers.