curl

How does cURL decide which when to reuse a connection?

The cURL library has a couple options called FRESH_CONNECT and FORBID_REUSE that help with special requests such as POST where responses often should not be stored. However, I want to know if curl is smart enough to know a post/delete/put request with parameters should not be cached - or if these parameters must be explicitly set. ...

cURL and SimpleBrowser

I have a script that lets me log into xbox live using simplebrowser. How ever the browser detector on xbox live takes me to a blank page after log in that has an empty form that needs to be submitted. But the form doesn't show on my browser so simplybrowser can't find it to submitted. The creator of the script says I need to use cURL, ho...

Error with cURL - "Could not resolve host: www.bbb.org(; No data record of requested type"

I am trying to access data of http://www.bbb.org/us/Find-Business-Reviews/ with cURL. Now I used HTTPFox to see what data does this site send and accordingly made an array to "POST" to the page. But I am having problem in accessing Page 2,3,4,5... Here is the array - $array = Array(); $array['__EVENTTARGET'] = 'ctl12$gc1$s$gridResult...

Segmentation fault in libcurl, multithreaded

So I've got a bunch of worker threads doing simple curl class, each worker thread has his own curl easy handle. They are doing only HEAD lookups on random web sites. Also locking functions are present to enable multi threaded SSL as documented here. Everything is working except on 2 web pages ilsole24ore.com ( seen in example down ), and...

Running a php script in the background without curl

Im having a little trouble with running a php script in the background. I have my admin area which has HTTP authentication to access and a mail out script which I want to run in the background. This script will take a long time to execute so I wish it to execute in the background. My idea is when I access the "send" page, it executes t...

PHP cURL code fails online but not on localhost. Please help!

Hello Everyone! I cannot figure out why this code works locally on my PC (localhost) but not online on a public server? Can it be a PHP version issue? Thankful for all help! $post_data = array('item_type_id' => '8', 'string_key' => 'Test Nyckel2', 'string_value' => 'Test Varde2', 'string_extra' => 'Test Extra', 'numeric_extra' => 'T...

cURL is returning 404 on a file that exists (remote server). Why?

I'm checking to see if certain mp3's exist. While sometimes there's no problem, certain valid mp3 files are shown as 404, not found. Here's the code I'm using: $ch = @curl_init($file_path); @curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_NOBODY, true); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @curl_setopt($ch,...

Using cURL to download images to ZipArchive

Hi, I'm trying to download images to a ZipArchive, from a social networking site via their API, I'm using the following code: ... public function downloadAlbumZip($album_name, $photos) { $zip = new ZipArchive(); $album_name = $this->_cleanAlbumName($album_name); $filename = 'album.zip'; $file = tempnam(PHOTOS, "{$album_n...

file_get_contents() connection refused for my own site

I've been trying to connect to my own site using both CURL and the PHP file_get_contents() function to get source of my webpage without success. I am running the PHP script on the same server that I am trying to get the HTML source from. CURL doesn't return any errors, not even when using curl_error(), and the PHP file_get_contents() fun...

how can i post JSON object through cURL in php

How can I post JSON objects to a web service, through cURL in php? I have an array $data = array('username'=>'abc','password'=>'pass'); The webservice which I want to call accepts JSON object, if I convert the $data to JSON with json_encode, its not working for me. $data = json_encode($data); curl_setopt($ch, CURLOPT_POST ,1);...

Prevent memory overflow

At some point in my php script that makes use of curl, the following error shows up: "Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 77824 bytes) in"... It points out this part of the script: "$s = curl_exec($c);" What is the problem? And how to settle it down? ...

securely pass api key from remote server to authentication page

This is my first time building an authenticated API and I'm running into a few roadblocks. How do I securely pass an API key from the remote client's page to my server (for the user to authenticate connecting his account to the client's page/app)? -dylan ...

Simulate a click with CURL (PHP)

Hi everybody, I'm using CURL to extract some real estate listings. But, recently, a website changed his way to communicate the phone number: The visitor must click on a "Show the phone number" link that returns the result in jSon. I found these information with Firebug: http://www.realestate.com/phone/click.json?Id=023DSFS And for th...

twitter oAuth cURL Example not working - why?

The following code simply gives me: Failed to validate oauth signature and token // Set url $url = "http://api.twitter.com/oauth/request_token"; // Params to pass to twitter and create signature $params['oauth_callback'] = "http://localhost/twitter/tweet/"; $params['oauth_consumer_key'] = $...

another twitter oAuth cURL access token request that fails

The following function gives a validation error instead of the token: failed to validate oAuth signature and token function request_token() { // Set url $url = $this->site.$this->request_token_path; // http://api.twitter.com/oauth/request_token // Params to pass to twitter and create signature $params['oauth_consumer_...

cURL doesn't seem to work in a while loop

I'll just post the whole thing since it would be a bit confusing otherwise: <?php echo "<html> <head> <title>ARMORY.</title> <meta http-equiv='Content-Type' content='text/html' charset=iso-8859-1> </head> <body> <table width='50%' border='1' cellpadding='10' cellspacing='10'>"; $server = "Sunstrider"; $guild = "Mist"; $url='ht...

curl simulation for facebook publishing

To publish photos on the Facebook need to perform: curl -F 'access_token=...' \ -F '[email protected]' \ -F 'message=Caption for the photo' \ https://graph.facebook.com/me/photos example from developers.facebook.com/docs/reference/api/photo How to create the same POST request in the iPhone app? ...

Login Javascript within PHP

Hi, I have been creating a web scraper for an internal application with PHP but one of the pages has a JavaScript login is there any way of autonomously logging in to scrape the data as usual? (I am using curl to log in to the other two sites) ...

curl downloading a file fails

For some reason when I use my php script to download files via curl it keeps just giving up after a few bytes have been downloaded whereas it was working fine a few weeks ago. The curl error is: transfer closed with xxx bytes remaining to read I'm running this on localhost but it works fine on my server, I've also tried restarting apach...

Sending Geolocation to a Server via PHP CURL

I am trying to scrape data from a site that requires my geolocation via PHP and CURL. Is there any way to include Geolocation into the CURL call? ...