Tag Archives: curl

How to download a file using Curl in PHP – Code Snippet

By | January 13, 2023

Download a File using Curl Here is a quick curl snippet for php, that can download a remote file and save it. <?php set_time_limit(0); // File to save the contents to $fp = fopen ('files2.tar', 'w+'); $url = "http://localhost/files.tar"; // Here is the file we are downloading, replace spaces with %20 $ch = curl_init(str_replace(" ","%20",$url));… Read More »

Use clientside ssl certificate with curl and php

By | June 13, 2012

Clientside certificates are often used in soap webservices. For example the wsdl file link might require a clientside certificate. The server throws an error like this : HTTP Error 403.7 – Forbidden: SSL client certificate is required. Curl Command To use clientside certificate with curl , test the following command curl –cert certificate_file.pem https://www.example.com/some_protected_page or… Read More »