Tuesday, January 13, 2015

Post data using curl

visual basic, vb, active server pages (ASP),java, javscript,c, c++, c__ , vbscript,active server pages, ASP, vbscript,SQL, database, informix, oracle, SQL Server,Perl, CGI,Delphi, PHP,source code, code, sample, samples, program, programs, help, tutorial,tutorials, routine, routines, jobs, listserve, mailinglist, bulletin board, bulletin boards, programming,  snippet, snippets, control, controls, class, classes, module, script, Scripts, applet , email , mp3, reference, windows,  modules, file, files, subroutine, subroutines, function, functions, sub, Microsoft, Sun,  downloads, winapi, directx, msaccess, ocx, vbx, ado, dao, odbc, rdo,  vbscript, vba, game programming, dcom, ole, com, dna, jet, dll, win api, winapi,  dbgrid, database front end, certify, decompiling, decompiler, visual basic for applications,  va  riable, constants, data type, byte, boolean, integer, long, single,  double, currency, date, object, string, variant, sub, function, free, 01/11/2015

Learn a little more about PHP World each day, with www.Planet-Source-Code.com's Code of the Day!

Current # of subscribers: 5,990


Make 9 cents to $300 per game playing Dollar Candy. The better you get, the more you make. Click for more info.

=================================================================
Would you like access to thousands of lines of source code instantly from your desktop? Then check out the Planet Source Code CD...hundreds of amazing programs at your fingertips with no online wait!
Click Here!

  



Code of the Day: (
What is the code of the day?
)
1) Post data using curl

Submissions Since Yesterday:

NONE
 





1)Post data using curl


Category: Coding Standards
Level: Intermediate

Description: Se here: http://agalaxycode.blogspot.in/2015/01/post-data-using-curl.html Problem: How to post data using curl in php? Solution: You need to use POST method in curl. Example: $str_to_post = "login=mylogin&pass=mypass"; $crl = curl_init('http://localhost/mysite/dologin'); curl_setopt($crl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($crl, CURLOPT_POSTFIELDS,$str_to_post ); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); $ans = curl_exec($crl); Other example is: $postdata = array( 'login' => 'mylogin', 'pass' => 'mypass', 'logintype' => '1' ); $crl = curl_init(); curl_setopt($crl, CURLOPT_URL, "http://localhost/mysite/dologin"); curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($crl, CURLOPT_POST, true); curl_setopt($crl, CURLOPT_POSTFIELDS, $postdata); $ans = curl_exec($crl);

Compatibility: PHP 5.0
Submitted on 1/8/2015 1:26:30 AM and accessed 35 times.

     Back to Top




No comments:

Post a Comment