curl

cURL equivalent in Java

Hi, I had exec( "curl". " --cert $this->_cCertifikatZPKomunikace". " --cacert $this->_cCertifikatPortalCA". " --data \"request=".urlencode($fc_xml)."\"". " --output $lc_filename_stdout". " $this->_cPortalURL". " 2>$lc_filename_stderr", $la_dummy,$ln_RetCode ); in php. I have to do it via java. Can you help me? Than...

Posting an array with curl_setopt

Hi, The attached code is returning "Notice: Array to string conversion in...". Simply my array is being handled to the remote server as a string containing "Array" word. the rest of the variables are fine. How can I pass my array ($anarray) without this problem? Thanks. <?php $data = array( 'anarray' => $anarray, 'var1' => ...

Show png file on Web page

All, I am executing a PHP script through CURL which returns a PNG file as an output. How can I show the png file in a php web page? ...

What is the best way to detect if a proxy server is available?

I'm trying to write a tool to check if a proxy server is up and available for use. So far, I've come up with two methods in the class below (I've removed setters and getters that are superfluous to this question). The first method uses cURL and tries to request a page via the proxy, the second tool uses fsockopen and just tries to open...

how to randomly assign proxy for curl ?

hi, i want my curl to use random proxy from the proxy.txt file that is saved in my site with this format: 1.1.1.1:8080 2.2.2.2:8080 3.3.3.3:8080 ... I want it to make it randomly so that every time it uses different proxy from the proxy.txt list, but i have no idea i can code something like that in php. ...

Why can't I generate Excel file through cURL/PHP?

Hi there, I'm trying to use a post form to generate an excel file after choosing which data to grab from a MySQL database. I'm using cURL because I essentially want to double-post: first to save any settings of which fields are being used, and second to generate the Excel file, all with one button. I have a PHP page set up with the cor...

How do I CURL www.google.com - it keeps redirecting me to .co.uk

I am using CURL to check for the existence of a URL (HEAD request) but when I test it with www.google.com, it redirects me to www.google.co.uk - probably because my server is UK-based. Is there a way you can stop this from happening? I don't want to remove the CURLOPT_FOLLOWLOCATION option as this is useful for 301 redirects etc. Part...

php cURL , POST and redirect client , proxy/bridge

I'm trying to make a php cURL script that should act like a bridge/proxy (like "man in the middle" but nothing hacking ), make a POST to a url (example.com) and redirect the client to that link after it gets the response . I'm not sure if it's possible so please advise. Basically the client will pass 2 values through our site (e.g exam...

curl halts script execution

my script uses curl to upload images to smugsmug site via smugsmug api. i loop through a folder and upload every image in there. but after 3-4 uploads, curl_exec would fail, stopped everything and prevent other images from uploading. $upload_array = array( "method" => "smugmug.images.upload", "SessionID" => $session_id, "Alb...

How to send post data to any url (with redirection) without using curl or fsocket in php

Hello, I would like my page to be redirected to new url with some post data being sent to it. I don't want to use curl or fsocket because they will not redirect user to that new url. Is there any alternative for header("Location: blahblahblah"); to send post data? I tried with document.form.submit(); and it worked but some users are fa...

/bin/sh: get: command not found

Hello! When I try to run a script by cron I get this error messaege: /bin/sh: get: command not found I also tried it in bash shell, and I tried 'curl', 'wget' and 'fetch' but non of them helped. Can anybody tell solution? : D ...

Is there any way I could get this behavior with cURL?

I am testing one of my server implementations and was wondering if I could make curl get embedded content? I mean, when a browser loads a page, it downloads all associated content too... Can someone please tell me how to do this with curl? I don't mind if it dumps even the binary data onto the terminal... I am trying to benchmark my ser...

How do you proxy though a server using ssh (socks…) using php’s CURL?

I want to use ssh, something like this: ssh -D 9999 username@ip-address-of-ssh-server But within php CURL, but I don't really see how this could be done? I noticed “CURLPROXY_SOCKS5” as a type in the php site, but guess that wouldn’t work since it isn’t really socks, it’s ssh… I’m currently using this code: curl_setopt($ch, CURLOPT...

How to test for "If-Modified-Since" HTTP Header support

Using PHP how can I accurately test that a remote website supports the "If-Modified-Since" HTTP header. From what I have read, if the remote file you GET has been modified since the date specified in the header request - it should return a 200 OK status. If it hasn't been modified, it should return a 304 Not Modified. Therefore my q...

PHP Curl: Getting a directory listing and downloading directories connecting to HTTP

I'm fairly new to CURL and I was able to fetch individual files like this: $c_session = curl_init(); curl_setopt ($c_session, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($c_session, CURLOPT_URL, $uri); curl_setopt ($c_session, CURLOPT_TIMEOUT, '12'); $content = curl_exec($c_session); curl_close ($c_session); Now I need to be able to li...

Script level login to Grails app using Acegi security

Scenario: I have a Grails app that uses Acegi security for authentication. I'm implementing a REST service endpoint in the app and want to be able to GET and POST to / from the service endpoint using a shell script. I've been trying to use curl to do this, but can't find the right combination of parameters to make the curl command log ...

CURL login by script to a Joomla website

Hello, I need to login by a PHP script that uses CURL to a Joomla website, in order to access to a private page that needs to be processed, but nothwithstanding several attempts I have done, I have always a 403 error. I have done a similar thing with other websites and it worked. Script I use: $uname = "id"; $upswd = "pswd"; $url = "h...

Best way to manage long-running php script?

I have a PHP script that takes a long time (5-30 minutes) to complete. Just in case it matters, the script is using cUrl to scrape data from another server. This is the reason it's taking so long; it has to wait for each page to load before processing it and moving to the next. I want to be able to initiate the script and let it be unti...

Extracting portions of a loaded page in PHP (RegEx)

I have a newsletter system I am trying to incorporate within a PHP site. The PHP site loads a content area and also loads scripts into the head of the page. This works fine for the code that is generated for the site but now I have the newsletter I am trying to incorporate. Originally I was going to use an iFrame but the amount of AJAX ...

In Android, how do I download the HTML of a webpage?

In Python, I use a class called "urllib". I'd just like a simple function where I can download the HTML of a webpage. ...