curl

How do I POST XML data with curl

I want to post XML data with cURL. I don't care about forms like said in How do I make a post request with curl. I want to post XML content to some webservice using cURL command line interface. Something like: curl -H "text/xml" -d "<XmlContainer xmlns='sads'..." http://myapiurl.com/service.svc/ The above sample however cannot be pro...

loading remote data on server in PHP

Hi, I am trying to load content from a remote URL in my php code. There are two restrictions: I need to use the dedicated server IP I have so the REMOTE_ADDR of the other server has to be my dedicated IP. This eliminates Curl because Curl uses a proxy to load the remote URL and the proxy changes the IP address which does not work. I ne...

Encoding an ampersand for twitter w/ curl

Here's my code: curl -u "u:d" --data-urlencode "status=`echo $@|tr ' ' '+'|tr '&' '%26'`" "http://twitter.com/statuses/update.json" But when it goes to twitter, the '&' turns into '%'. What am I doing wrong? Thanks! ...

PHP cUrl mimic web login help

Hi, I've been trying to automatically log in to specific web page but no success till now. I would really appreciate any help to get me moving.... This is the URL for the login page: https://www.cellcom.co.il/login/pages/default.aspx The first field is for the username and the second is for the password. I've been using the Live HT...

Download problem with libcurl after connection loss

How can I cancel the curl_easy_perform() function after a connection loss (Network cable drawn)? I'm using the the function to download files from a server via http request under Mac OS X. After the connection gets lost the application hangs in curl_perform. I've tried to solve the problem by using the CURLOPT_TIMEOUT option. But this ...

Using the default filename (content_disposition) when downloading with CURL

I'm trying to download some files with PHP & CURL, but I don't see an easy way to use the default suggested filename (which is in the HTTP response header as Content-Disposition: attachment; filename=foo.png ). Is there an easier way then get the full header, parse the file name and rename? ...

PHP PECL_HTTP vs cURL Extension

I'm working on a PHP Client for CouchDB. While browsing through the php.net documentation regarding HTTP and cURL, I came across the PECL_HTTP Extension. At first glance, I think I would like to use this PECL extension instead of cURL because it's much simpler to use, and I'm not doing very complicated HTTP work anyways. Plus I always li...

Is it safe to use proxies?

hi! i'm using php curl's proxy feature to sign in to a site. I wanna know whether this is safe or not. Can the proxy site "hack" my usename and password? I don't, actually can't, encrypt my password before sending it to the proxy server. EDIT: The scenario is like this: I'm trying to scrape data from a members-only page. I sign-in wit...

php/curl: Timeout problem when remote server curling itself

Hi! I have a simple "server" script that just echos a line: <?php echo "Server script on http://".$_SERVER['SERVER_NAME']." saying hello!"; And a "client" script curling the server script: <?php echo "Client script"; $url = "http://localhost/server.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CU...

Handling PUT/DELETE arguments in PHP

I am working on my and I am struggling to work out how to send PUT and DELETE arguments in PHP. In a few places I have seen people using the options: $this->option(CURLOPT_PUT, TRUE); $this->option(CURLOPT_POSTFIELDS, $params); Annoyingly, this seems to do nothing. Is this the correct way to set PUT parameters? If so, how do I set ...

String to array without explode

Hello, I am using an api to retrieve data from another server the data returned is something like this: accountid=10110 type=prem servertime=1263752255 validuntil=1266163393 username= curfiles=11 curspace=188374868 bodkb=5000000 premkbleft=24875313 This is a whole string I need two values out of whole string, I am currently using pr...

cURL for webpage login

I want to submit my submissions to this competition automatically from my code. I need to log-in on this page and then submit a file on this page. I'd like to use cURL since it integrates with both of the languages that I am using (R and Python). I am just wondering if this procedure is possible in cURL? and my another question is if I...

creating a file downloading script with checksum verification

I want to create a shellscript that reads files from a .diz file, where information about various source files are stored, that are needed to compile a certain piece of software (imagemagick in this case). i am using Mac OSX Leopard 10.5 for this examples. Basically i want to have an easy way to maintain these .diz files that hold the ...

PHP Curl with Google Calendar

<?php if(isset($_GET['token'])) { $url="http://www.google.com/calendar/feeds/default/allcalendars/full"; $useragent="PHP 5.2"; $header=array( "GET /accounts/AuthSubSessionToken HTTP/1.1", "Content-Type: application/x-www-form-urlencoded", "Authorization: AuthSub token=".$_GET['toke...

php upload xml to google api

Hi, I need some help with this problem, please. For days I have been trying now. The retrieving off feeds and parsing them is not really a problem, but Uploading data in the form off xml is? The code below is partially from the google docs samplecode also, but obviously it's not working. I hope someone else is more into the google ap...

curl cookie problem in PHP

hi as my client needs, I developed a code to login via cURl. login to www.web1.com and store cookies in cookie.txt go to www.web2.com and browse a page using that cookie.txt no problem with www.web2.com so when i want to do this with www.web3.com, the problem appears. the www.web3.com uses session and cookies itself and I have to...

curl --form file redirection

Hello, This works: curl --url http://someurl.tld --form "apikey=39485730" This does not: curl --url http://someurl.tld --form "apikey=<keyfile" Error: Invalid API keys The cURL manual (http://curl.haxx.se/docs/manpage.html) explicitly states -F/--form (HTTP) This lets curl emulate a filled-in form in which a user has ...

PHP and CURL under Windows 7 64 bits and Apache

I'm trying to use curl with PHP on my box without any success. My Config : OS : win 7 64 bits, PHP : 5.3.1, Apache : 2.2.14 I was able to use the mysql extension, so the configuration of my php.ini seems fine. But I get and error in Apache log with curl : PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php-5.3.1/e...

Problem with cURL in PHP

At work im having a big issue getting a cURL piece of our application to work on our live environment, but it works alright on our QA servers. The server environments are "supposed" to be the same. cURL is executing, but the data is not being posted back. What i want to know is... is there something on the server that i could check to ...

How to open multiple socket connections and do callbacks in PHP

I'm writing some code which processes a queue of items. The way it works is this: Get the next item flagged as needing to be processed from the mysql database row. Request some info from a google API using Curl, wait until the info is returned. Do the remainder of the processing based on the info returned. Flag the item as processed in...