curl

Make a POST request

I would like to know how to make a HTTP POST request like it's described there http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#UploadingMetadata (Creating an empty document). My code looks like this: <?php $headers = array( "POST /feeds/default/private/full HTTP/1.1", "Host: docs.google.com", "...

PHP Multiple Curl Requests

Hi, I'm currently using Curl for PHP a lot. It takes a lot of time to get results of about 100 pages each time. For every request i'm using code like this $ch = curl_init(); // get source ch_close($ch); What are my options to speed things up? How should I use the multi_init etc>? ...

PHP curl bandwidth

Hi, I have a php script that uses curl to download a remote file. Let's say I have two servers: a and b. And the script file name is curl_download.php on the a server. When I access curl_download.php?filename=something, it promtes browser's download window. Am I using bandwith on server a or b? or both? I assume both, but I am not ...

Undefined Variable in PHP

Hi guys, I'm working towards sending an XML request to a URL using cURL in PHP. First I just wanted to make sure my request is sending the right data so here is a snippet from my code. I will add the curl statements in later once I know i'm sending the right data. here is my code so far: $format = 'Y-m-j G:i:s'; $date = date ( $fo...

Rails app, upload via API, test via curl

How can i make my photo rails app to receive images (and handling them with paperclip) through the built in API using paperclip plugin. My app works fine when upload from browser..How can i test the API with curl command? How can specify the end-point url? thanks. ...

Multiple cURL actions, same session

First of all I'm aware of curl_multi_init but it doesn't exactly do what I need, to my knowledge. Im downloading files behind a login, so a) Need to login b) Download image(s) Here is what I currently have $login_url = 'https://us.test.com/Member/Login'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$login_url); curl_setopt($ch, ...

PHP image proxy breaks in PHP 5

I have this image proxy. It worked fine in PHP 4 but not that I have upgraded to 5 I get this error: Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /path/to/proxy.php on line 34 Here is line 34: curl_setopt($session, CURLOPT_FOLLOWLOC...

Suggestions on how to access google webmaster tools' api through R ?

I wish to access my Google Webmaster's tools' API via R. I see from here: http://code.google.com/apis/webmastertools/docs/2.0/reference.html That it requires fetching a feed behind https and parsing it. Any suggestions on how to do it? ...

PHP curl text vs binary data

How do I check multiple URLs with PHP. The data returned by from the urls might be in text (ASCII) format or in binary. How do i distinguish which one was returned. My code has to just detect if the data is binary or text. Nothing else. Thanks ...

Test when there are no properties

I've create a script that will delete all user properties for a particular individual. I'm able to use an api call to get the users' properties from the xml. And I'm using a delete api to remove each property. I would like to be able to test when there are no more properties left and then output a message accordingly. Inside the for lo...

How to get a snapshot of network video stream with curl in c/c++ in windows?

And exact the media type then save the captured image with correct extension? ...

How to get content on web page include content in javascript like see on browser

i need to get contents on web page and read it via cURL on php,but contents not include data on javascript any body can help me to solve this problem ? ...

Does a cURL post to the same site leave the local network?

I'm doing a PHP cURL post, using a complete URL (http://www.mysite.com), from one page to another on the same site. (I know this isn't the best way to do it; but for my purpose this is what I need) My question is: Will the cURL post still go out across the internet, do a name lookup and travel a route as though it were a post coming fr...

PHP and Curl - Get Ajax data

Is there a way to get data generated by AJAX using php Curl? Thank you. ...

Parsing HTTP status codes for interacting with API

I'm building a script in PHP to interact with an API and need to be able to parse the HTTP status code the API is giving me. For the most part, it gives one of the following responses: HTTP/1.1 401 Unauthorized HTTP/1.1 403 Forbidden HTTP/1.1 404 Not Found HTTP/1.1 410 Gone I need to be able to recognize which response is being gi...

Curl RETURNTRANSFER data ?timing? problem and multiple identical POSTs

Hello, I am running into a sporadic problem with curl's RETURNTRANSFER option. I am not sure if I have overlooked something in my code that is causing it, or if it is just not well documented and I am unaware of the RETURNTRANSFER workings. I am using curl (via php) to send xml data via POST to an external listener. If successful, the ...

PHP Curl - Get data generated with AJAX

Hi, I want to get data generated by an AJAX request. In this page http://www.fipe.org.br/web/index.asp?p=51&amp;aspx=/web/indices/veiculos/default.aspx there are some html selects. When the user click on the first one (Marca), the second one is filled. I want to get this data. This is my code: <?php $curl = curl_init(); $postData = arr...

Looping through Array PHP

Hi all, I'm trying to loop through a cURL array response to generate XML files. However, my generated files all seem to have exactly the same contents - I don't know if this is the right approach or if I should be using an array, but I can't seem to figure it out and could use some fresh eyes. Basically, I want each $playlist's contents...

CURL - cookies are stored where?

I would like to login to a site, so the first time I request a page, it redirects me to another page setting the cookies. I am following a tutorial where they specify doing this $cookie = '/tmp/cookies.txt'; curl_setopt($ch, CURLOPT_COOKIE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); But when i check http live headers, th...

PHP Curl upload file through Post Data

How would I go by Submiting a file that in the same directory as this script inside the $data. The below function is what I currently use. If you find any bugs in the current code please tell me as well :) function post_data($site,$data){ $datapost = curl_init(); $headers = array("Expect:"); curl_setopt($datapost, CURLOPT_URL, ...