EzDevInfo.com

curl interview questions

Top curl frequently asked interview questions

How to display request headers with command line curl

Command line curl can display response header by using -D option, but I want to see what request header it is sending. How can I do that?


Source: (StackOverflow)

Using curl with a username and password?

I want to access a url which requires a username/password basic auth stuff. I'd like to try accessing it with curl. Right now I'm doing something like:

curl http://api.somesite.com/test/blah?something=123

so I just get some error back now, I guess I need to specify a username and password along with the above command, how can I do that?


Source: (StackOverflow)

Advertisements

How do I make a request using HTTP basic authentication with PHP curl?

I'm building a REST web service client in PHP and at the moment I'm using curl to make requests to the service.

How do I use curl to make authenticated (http basic) requests? Do I have to add the headers myself?

If so I've got some other questions -

  1. Is there a REST library for php?

  2. or is there a wrapper for curl that makes it a bit more rest friendly?

  3. or am I going to have to continue to roll my own?

Thanks.


Source: (StackOverflow)

How do I get cURL to not show the progress bar?

I'm trying to use cURL in a script and get it to not show the progress bar.

I've tried the -s, -silent, -S, and -quiet options, but none of them work.

Here's a typical command I've tried:

curl -s http://google.com > temp.html

I only get the progress bar when pushing it to a file, so curl -s http://google.com doesn't have a progress bar, but curl -s http://google.com > temp.html does.


Source: (StackOverflow)

PHP cURL custom headers

I'm wondering if/how you can add custom headers to a cURL HTTP request in PHP. I'm trying to emulate how iTunes grabs artwork and it uses these non-standard headers:

X-Apple-Tz: 0
X-Apple-Store-Front: 143444,12

How could I add these headers to a request?


Source: (StackOverflow)

How do I install/set up and use cURL on a Windows?

I have downloaded the latest cURL zip file from the website ver 2.7.24.zip. Now how do I install this in my windows environment to be able to use it? I do not need to build cURL from the source just to use it.
do I need to compile it? If yes, then how do I do that?

I looked for any documentation on installation, but that points to installing cURL as project from source.


Source: (StackOverflow)

PHP + curl, HTTP POST sample code?

Can anyone show me how to do a php curl with an HTTP POST?

I want to send data like this:

username=user1, password=passuser1, gender=1

To www.domain.com

I expect the curl to return a response like result=OK. Are there any examples?


Source: (StackOverflow)

How to do a PUT request with curl?

How do I test a RESTful PUT (or DELETE) method using curl?


Source: (StackOverflow)

How do I get a YouTube video thumbnail from the YouTube API?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?


Source: (StackOverflow)

How to send a header using a HTTP request through a curl call?

I wish to send a header to my Apache server on a Linux box. How can I achieve this via a curl call?


Source: (StackOverflow)

How can I see the request headers made by curl when sending a request to the server?

I want to see the request headers made by curl when I am sending a request to the server. How can I check that?


Source: (StackOverflow)

Run cURL commands from Windows console

Is there a way to install cURL in Windows in order to run cURL commands from the command prompt?


Source: (StackOverflow)

Getting only response header from HTTP POST using curl

One can request only the headers using HTTP HEAD, as option -I in curl(1).

$ curl -I /

Lengthy HTML response bodies are a pain to get in command-line, so I'd like to get only the header as feedback for my POST requests. However, HEAD and POST are two different methods.

How do I get curl to display only response headers to a POST request?


Source: (StackOverflow)

PHP cURL not working - WAMP on Windows 7 64 bit

I got my WAMP installed on my windows 7 64bit. cURL is not working, but still I got it enabled from the WAMP tray.

I have also uncommented extension=php_curl.dll in php.ini for both the PHP and Apache folder.

Windows give me an error message,

PHP Startup: unable to load dynamic library 'c:/wamp/bin/php/php5.4.3/ext/php_curl.dll' - the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-lin sxstrace.exe tool for more detail."

How can I fix this problem?


Source: (StackOverflow)

Linux curl command with proxy

I have this proxy address: 125.119.175.48:8909

How can I use it with the curl command, for example: curl http://www.example.com, but I need to do this using the proxy address.


Source: (StackOverflow)