Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-06-2006, 08:00 PM
falco85 falco85 is offline
Programmer
 
Join Date: Apr 2006
Posts: 105
Rep Power: 10
falco85 is on a distinguished road
Default POST in PHP

I've tried again and again but I can't get it to work. How can I POST data from my PHP script and retrieve the results??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-09-2006, 12:31 PM
Thomas Thomas is offline
Newbie
 
Join Date: Sep 2006
Posts: 15
Rep Power: 9
Thomas is on a distinguished road
Default

Hi Falco,

Can you tell me if your trying to POST to another HOST or if your using a FORM and want to display the results of the entered fields?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-09-2006, 01:13 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,228
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

Yes, if you are trying to post using a FORM it is a little different than if you are posting to another host. Form post, as you may know, is simply HTML:

HTML Code:
<form action="postscript.php" method="POST">
Here is how you POST to a form using [ CURL ] on another host:

PHP Code:
<?
$url
="http://anything";
$ch curl_init();
curl_setopt($chCURLOPT_URL$url);
curl_setopt ($chCURLOPT_POST1);
curl_setopt ($chCURLOPT_POSTFIELDS"fieldname=fieldvalue&fieldname=fieldvalue&");
#curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
$store curl_exec ($ch);
$content curl_exec ($ch); # This returns HTML
curl_close ($ch);
?>
To get the page only using the URL (no POST data):

PHP Code:
<?
$url
="http://anything";
$ch curl_init();
curl_setopt($chCURLOPT_URL$url);
curl_setopt ($chCURLOPT_RETURNTRANSFER1);
$store curl_exec ($ch);
$xml curl_exec ($ch);
curl_close ($ch);

?>
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-13-2006, 10:15 AM
dirkfirst dirkfirst is offline
Programming Professional
 
Join Date: May 2006
Posts: 338
Rep Power: 12
dirkfirst is on a distinguished road
Default

Some places do not let you post like Google. You had better check the TOS of the sites you want to post/retrieve from.
__________________
DirkFirst
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-14-2006, 09:24 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default

also depending on your registred global settings you may have to use $_POST['variable'] on the page you are posting to.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 4 end of life announcement Jordan Programming News 4 08-30-2007 10:55 AM


All times are GMT -5. The time now is 04:10 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads