| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Aug 2005 Location: Canada
Posts: 591
![]() ![]() ![]() ![]() ![]() ![]() | Can anyone advise on Curl? I've managed to figure out how to convert an fopen command in the past but this one stumps me.If anyone can assist in coming up with a usable curl command it would be greatly appreciated.It comes from cp_email script. `````````````````````````````````````````````````` ````````` $filepointer = fopen($url,"r"); if($filepointer){ while(!feof($filepointer)){ $buffer = fgets($filepointer, 4096); $file .= $buffer; } fclose($filepointer); } else { die |
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Pulled this from one of my old scripts, maybe you can hack at it... PHP Code: |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Jun 2004
Posts: 587
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | SecondVersion has the basics above. Basically what you have to do is initialize the curl sesison, set the options, then execute the command. The most difficult portion is setting the options. PHP Code: If you want to DISPLAY the results, then don't set it (or set it to 0). If you want to CAPTURE the data for processing and store it in a variable, you MUST set the "RETURNTRANSFER" variable to 1. If you want to POST data to a URL (i.e. like you were posting info from a form), then you need to build the query string in a loop- something like: PHP Code: Here is one example I had that interacts with Authorize.net: PHP Code: Good luck! -Bob
__________________ Can't wait to be out of this forsaken business. Getting close! :) |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Php Module help (cUrl) / Alternative | squirrelbacon | Programming | 2 | 12-01-2005 09:15 AM |
| Need help with curl install will pay NP | dreaminginspiration | Programming | 5 | 11-19-2005 02:00 AM |
| Newbie looking for advise. | napalm747 | Website Development | 8 | 06-11-2005 08:31 AM |
| Need Advise! | patches | Domain Name Discussion | 1 | 04-22-2005 11:35 AM |
| Registrar Question.. please advise | Wanda | Domain Name Discussion | 4 | 09-15-2004 05:20 PM |