curl

Convert CURL to fosckopen in PHP

I am working on setting up credit card processing for a site that is live. PHP wasn't compiled with CURL support and I don't want to take the site down to recompile PHP with that, so I am trying to use a different method than the example code provided. Example CURL code: function send($packet, $url) { $header = array("MIME-Version...

file_get_contents with https?

I'm working on setting up credit card processing and needed to use a workaround for CURL, and the following code worked fine when I was using the test server (which wasn't calling an SSL URL), but now when I am testing it on the working server with https, it doesn't work ("failed to open stream"). function send($packet, $url) { $ctx =...

CURL with PHP - Very slow

All, I have to request a URL which returns a JSON request. I am using PHP and CURL to do this. Currently it takes around 3-4 seconds for the request and response. Following is the curl code $ch = curl_init(); $devnull = fopen('/tmp/curlcookie.txt', 'w'); curl_setopt($ch, CURLOPT_STDERR, $devnull); curl_setopt($ch, CU...

Solution to HEAD request problems

I have been working on a script to post customer data to a dialing server. I posted a similar problem about this a while ago but was finally able to get some responses. However, I am facing another issue. When I test the script from my localhost server, the data is being sent successfully and I get a 200 OK http response. From my loca...

Download a file that is forced as attachment with PHP

Hi, I am trying to download a file with PHP from an FTP server which i can access from http too. For example: FTP://username:[email protected]/file_name_here.gz. The file is forced as an attachment from the server (not as a PDF or TXT would do eg: output). I tried it with 3 different methods: file_get_contents -> Return a zero ...

Logging into a PHP forum using lib-cURL and getting a page contents

This is my code: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.membersite.com/login.php"); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=deleted&password=deleted'); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'C:\xampp\htdocs\scrape\cookie.txt'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);...

compiled or interpreted / apache mod or FastCGI for this use case?

We have a server-side component that is currently written in PHP on Apache2 that is essentially a cross domain proxy that uses cURL to make external HTTP requests, does header processing and performs some regular expression replacement on the payloads. It is going to be the most heavily used piece of server-side code for our site. PHP i...

copy data from remote server -- got problem

I wanted to copy files from a remote server, but it seems that the remote host is using session, and needs cookies. well I used this method after defining variables... $url="http://example.org/exmple.mp3"; $nn = "\r\n"; $cookies=""; $request = GET . " " . str_replace ( " ", "%20", $url ) . " HTTP/1.1" . $nn . "Host: " . $host . $nn . "...

cURL without cURL- problem

I wanted to copy files from a remote server, but it seems that the remote host is using session, and needs cookies. well I used this method after defining variables... $url="http://example.com/stamp/stamp.jsp?tp=&arnumber=5255176&isnumber=5255174"; $nn = "\r\n"; $cookies=""; $request = GET . " " . str_replace ( " ", "%20", $url...

Download files one at a time, not all at once

What I'm trying to do is download a set of images, about 200 of them. Now, I could install some addon or a script to firefox that just lets me download em all with a few clicks, but before I thought of doing that, I was thinking on how I could do this with a few lines of code. Languages I have at my disposal are C#, Java and PHP. I'd pr...

Retrieving iTunes App Store XML with cURL and PHP

Hey guys, I have been extracting information from the iTunes App Store for the past couple of weeks using a script I found and modified. Everything was working fine until a couple days ago when I realized that no XML was being generated anymore. Here is the code for the script that generates the XML: <?php header("Content-type: text/pl...

Convert a curl POST request to Python only using standard libary

I would like to convert this curl command to something that I can use in Python for an existing script. curl -u 7898678:X -H 'Content-Type: application/json' \ -d '{"message":{"body":"TEXT"}}' http://sample.com/36576/speak.json TEXT is what i would like to replace with a message generated by the rest of the script.(Which is already w...

How to 'explode' this page output

Hi, I'm trying to parse the output of this page -> http://master.anti3d.com/raw_server_list2.php The documentation of that master server says that every entry is separated in this way Note: LF = LineFeed = 10 Format: serverName[LF]ipAddress:port;users/maxusers;gameCount;version;location[LF] Example: Server Name1 ...

Setting a cookie for cURL to use.

I am retrieving another page using cURL, and unless I have a certain cookie I cannot see the page content. The cookie name is seepage and its value must be set to 1 for me to see the page content. I would like to load this page using cURL, and this is the script I have at the moment: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_...

get the value of an url response with curl

Hi, I am using PHP curl method to get a string type response. To create the request I use: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($...

Jquery on curl fetched data

I have a div which is being populated through curl from another html page .Now the data is populating correctly but i want to use jquery or javascript on the ids or classess of the fetched data. I tried using livequery ,binding but of no use. Can you please help me . ...

using curl to get from one webpage to another involving javascript

Hi, I have webpage1.html which has a hyperlink whose href="some/javascript/function/outputLink()" Now, using curl (or any other method in php) how do I deduce the hyperlink (of http:// format) from the javascript function() so that I can go to next page. Thanks ...

Register And Login To SMF With CURL

I'm working on a website that has a forum area, I will probably use the SMF forum software for the forum. Users can register and log in on the website. I would like to achieve that when they register on the website, they get also registered on the forum (they don't have to register twice). And also when they log in to the website that wo...

why can't curl download the same URL in different format ?

curl downloads http://mysite.com/Lunacy%20Disc%202%20of%202%20(U)(Saturn).zip but not http://mysite.com/Lunacy Disc 2 of 2 (U)(Saturn).zip Why is this the case? Do I need to convert it to the first format ? using the URL generated via urlencode($url) fails. ...

Trouble with pycurl.POSTFIELDS

I'm familiar with CURL in PHP but am using it for the first time in Python with pycurl. I keep getting the error: Exception Type: error Exception Value: (2, '') I have no idea what this could mean. Here is my code: data = {'cmd': '_notify-synch', 'tx': str(request.GET.get('tx')), 'at': paypal_pdt_test ...