curl

CURL: not fetching url with unicode characters

I'm using CURL to fetch a Yahoo! BOSS api url with a unicode query, but I'm getting an "bad request" error. http://boss.yahooapis.com/ysearch/web/v1/கமல்ஹாசன்?appid={appid}&format=xml The above url works fine and returns results in firefox. Please could anybody help me to fix this. $url = "http://boss.yahooapis.com/ysearch/web/...

I am getting this error when using curl extensions Curl error: Could not resolve host: http://rss.news.yahoo.com; No data record of requested type

<?php ini_set("display_errors", 1); error_reporting(E_ALL); define ('HOSTNAME', 'http://rss.news.yahoo.com/rss/world'); //$path = ($_POST['rss_path']) ? $_POST['rss_path'] : $_GET['rss_path']; //$url = HOSTNAME.$path; $url = HOSTNAME; // Open the Curl session $session = curl_init(); curl_setopt($session, CURLOPT_URL, $url); // If ...

PHP newbie CURL and array question

UPDATED: I've simplified the code (tried to) I'm trying to download a series of images as set in an array, but something is clearly not right: function savePhoto($remoteImage,$fname) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_NOBODY, true); curl_setopt ($ch, CURLOPT_URL, $remoteImage); curl_setopt ($ch, CURLOPT_RETU...

problem with curl piping $_POST and $_FILES in same request

I'm trying to recreate an entire http request including both post and files data however no matter what I do I can't seem to get my files to work, the code I'm using is below... $count=count($_FILES['photographs']['tmp_name']); $file_posts=array(); for($i=0;$i<$count;$i++) { if(!empty($_FILES['photographs']['name'][$i])) { $_...

How to get full text of request (not response) headers?

Hello, I have to ensure that curl is sending cookies propertly, so I should view full text of request (not response!) http headers. Is there any way to do it? Thank you ...

Specifying the Content-Type of each part of multipart/form-data in PHP's curl

How do I specify the content type of a specific part of a multipart/form-data request? The content type for the image is being sent as application/octet-stream, however the server is expecting it to be image/jpeg. This causes the server to deny my request. $data["file"] = "@/image.jpg"; $data["title"] = "The title"; $data["description"]...

php curl - sending form data to external website

Hello. I have a login form set up on my domain (eg: www.example.com/login). When the user enters their login information, I need those details to be passed through a login form on an external website and the user directed to the application that they are logging into. So to add the user steps to this: 1. User enters login information ...

cURL doesn't work from command line?

I wrote a script to parse some data from a website using cURL and it works fine when I run it in my browser, however when I want to run it in the command line I get the error "call to undefined function curl_init()". Do php scripts run under different settings from the command line? ...

php curl fail-over function for "couldn't connect to host"

I have a php curl script which crawls different websites . The problem is that after a while I think the websites place a kind of temporary ban on my IP and the script is unable to connect to the host anymore(as I'm getting "couldn't connect to host" error) . I would like to set a condition/function to make the script stop for a while (e...

Validate status of URLs in a mysql Database using CURL and shell script.

Good day, I have a simple MySQL database with 1 table and 3 fields Table: LINKS Fields: ID URL STATUS The table has about 3 millions links. I would like to check all the URLs and post their returned status in the status field so that I can remove the dead links later. This would probably require a shell script because it will nee...

How to duplicate a post http request with files without curl?

I want to duplicate a HTTP POST request from a form which includes file elements, as if there were just 2 action attributes with different targets on the form element. So far I have not been able to do this successfully with cURL for one reason or another, so I'm looking for alternatives (that don't use the cURL library what-so-ever, t...

Is there anyway to change default values for php curl options, for a script session or globally?

I'm using a framework which has curl handling encapsulated in the depths of it's class hierarchy. Basically I would like to change the way it does handle curl, without patching the files. It could be ideal if I could change curl defaults globally form outside. In php.ini or in similar way. Any way to accomplish this? ...

Problem with $_FILES and cURL

I'm having some trouble sending $_FILES by cURL - the files get transferred alright using the following code, however it is impossible for me to get the name, and type of the file, in fact once the $_FILES reach their destination their type is stored as "application/octet-stream" - what am I doing wrong!? $count=count($_FILES['thefile...

how to compile curl from source in windows?

I created this question for the suggestion under this answer ...

Why is the full response body not coming?

I am trying to get the response body from this HTTP Request. I tried doing it in Python (with various HTTP libraries), but for some reason the response cuts off at line 400 of what I see in the browser. So I tried with CURL and ended up with the same issue. curl -b "LSCOM_TIMEZONE_ID=US/Pacific; JSESSIONID=CCFD3E1C8EA041F186C176FDFBB4...

PHP: cURL and keep track of all redirections

I'm looking to cURL a URL and keep track of each individual URL it goes through. For some reason I am unable to accomplish this without doing recursive cURL calls which is not ideal. Perhaps I am missing some easy option. Thoughts? $url = "some url with redirects"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ...

Input specific data into database using CURL

Hello, I am new to using CURL, and a novice PHP coder. I would like to take specific elements on a web page (that change via AJAX) and input them into a databse using CURL. As of now, I can write a text file of a web page using CURL, but I dont really know where to go next. Any help would really be appreciated! ...

curl error 35 : unknown SSL protocol error in connection

$ curl -I https://9.185.173.135 curl: (35) Unknown SSL protocol error in connection to 9.185.173.135:443 This is an secured page that I need to access. But I don't know how to obtain its certificate file. I tried to use Firefox, but it says couldn't get any ssl certificate once the url is entered. $ curl -I http://9.185.173.135 HTTP/1...

Alternative Header() command to set Referer in PHP?

Hello PHP magicians! I am trying to initiate a download from a server that will give a 403 forbidden unless the referrer is set to the same domain. Currently Header() allows me to redirect the user to the file location and init a download, but referrer is always set to my script. Use of curl would cause the file to download on the serve...

Amazon Product API with PHP

Hi All, I'm trying to integrate Amazon Product API into my website and came across several posts that helped me construct the URL. Only problem is when I execute the code below I get the following error. Am I doing something wrong? Internal Server Error The server encountered an internal error or misconfiguration and was unable...