I’m writing a RESTful API. I’m having trouble with uploading images using the different verbs. Consider: I have an object which can be created/modified/deleted/viewed via a post/put/delete/get request to a URL. The request is multi part form when there is a file to upload, or application/xml when there’s just text to process. To handle the image uploads which are associated
Tag: curl
Can PHP cURL retrieve response headers AND body in a single request?
Is there any way to get both headers and body for a cURL request using PHP? I found that this option: is going to return the body plus headers, but then I need to parse it to get the body. Is there any way to get both in a more usable (and secure) way? Note that for “single request” I
php/curl – get extension of image on remote server using headers
There is a form on my website that allows the upload of images from a remote server. When the user enters the link and submits, I want to check the file and make sure it’s the right extension before I …
HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK
I am using XAMPP for development. Recently I upgraded my installation of xampp from an old version to 1.7.3. Now when I curl HTTPS enabled sites I get the following exception Fatal error: Uncaught exception ‘RequestCore_Exception’ with message ‘cURL resource: Resource id #55; cURL error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Php Curl adding Params
Im a newbie im trying to get a script to trigger another script with Curl in PHP but it dosent seem to be sending the paramaters. Is there a seperate function to append parameters? Could anyone point me in the right direction?? Answer You need curl_setopt() along with the CURLOPT_POSTFIELDS param. That’ll POST the given params to the target page.
remove comments from html source code
I know how to get the html source code via cUrl, but I want to remove the comments on the html document (I mean what is between <!– .. –>). In addition, if I can take just the BODY of the html document. thank you. Answer Try PHP DOM*: Output:
Send string as a file using curl and php
I know I can use this syntaxt to send a file using php, post and curl. $post = array( “file_box”=>”@/path/to/myfile.jpg”, ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); How can I take a …
How to disguise your PHP script as a browser?
We’ve been using information from a site for a while now (something that the site allows if you mention the source and we do) and we’ve been copying the information by hand. As you could imagine this …
Curl request is failing on the SSL?
I have this code if(ereg(“^(https)”,$url)) curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false); // execute, and log the result to curl_put.log $result = curl_exec($curl); $error =…
PHP – Debugging Curl
I’d like to see what the post fields in the request are before I send it. (For debugging purposes). The PHP library (class) I am using is already made (not by me), so I am trying to understand it. As far as I can tell, it uses curl_setopt() to set different options like headers and such and then it uses