Part of the EllisLab Network
   
 
Best way to send HTTP POST
Posted: 11 June 2009 06:31 PM   [ Ignore ]  
Summer Student
Total Posts:  7
Joined  06-11-2009

Hi, I’m new to CodeIgniter. I’m sending data to an API, and wondering what the best way to send an HTTP POST is? Thanks for any help.

Profile
 
 
Posted: 11 June 2009 06:51 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  869
Joined  09-25-2007

Easiest way is through a form in a view using:

<form method="post" action="<?=site_url()?>/blah_blah.php">
</
form>
Profile
 
 
Posted: 11 June 2009 06:59 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  17
Joined  06-11-2009

There is no specific support in CI that I have seen that supports HTTP POST like you’re looking to use it.  The best route for you to start with is looking into cURL or a custom HTTP library that you can import depending on cURL support at your hosting provider.  More information about cURL can be found on http://www.php.net

Profile
 
 
Posted: 11 June 2009 07:17 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  869
Joined  09-25-2007

and this is how to do it using php
http://netevil.org/blog/2006/nov/http-post-from-php-without-curl

Profile
 
 
Posted: 11 June 2009 07:31 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  7
Joined  06-11-2009

Thanks everyone. Anyone used http://alexpolski.com/2008/04/13/curl-library-for-codeigniter/?

Profile
 
 
Posted: 11 June 2009 07:33 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  869
Joined  09-25-2007

nope looks quite good though, I will bookmark that incase I need to use it. cheers.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120025 Total Logged-in Users: 36
Total Topics: 126159 Total Anonymous Users: 4
Total Replies: 663605 Total Guests: 352
Total Posts: 789764    
Members ( View Memberlist )