curl

serialize form to POST after getting content using CURL

Hi, I want to POST an URL using CURL and php. There is a big form on webpage and I don't want to manually copy all the variables and put it in my POST request. I am guessing there has to be a way to serialize the form automatically (using DOM or something) and then just change whatever values I need. I could not google my way out of ...

Why will this function using CURL work for some URLs but not others?

I'm writing a website in PHP that aggregates data from various other websites. I have a function 'returnPageSource' that takes a URL and returns the html from that URL as a string. function returnPageSource($url){ $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // mea...

Can I include CURL library in my PHP script as a class

I want to use CURL library but I don't want to install it in a hard way I just want to do something like this require_once('curl.php'); I am not sure if this possible or not? and where can I found this CURL class? thanks ...

file_get_contents VS CURL, what has better performance?

I am using PHP to build a web crawler to crawl millions of URLs, what is better for me in terms of performance? file_get_contents or CURL? Thanks. ...

cURL - Operation not permitted error

Hey, I'm trying to use cURL with PHP and its giving me this error: "Failed to connect to 208.77.188.166: Operation not permitted" I'm pretty sure its a server issue - but just in case, here is my code: <?php $ch = curl_init(); $url ="http://www.example.com"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSF...

PHP Curl , extract a XML response

hello, I am invoking PHP curl method on a server and the response is XML type. Curl is saving the output ( after removing the tags ) in a scalar type variable. Is there a way to store it in a object/hash/array. So that its easy to parse.\ Thanks ...

pycurl fails but curl (from bash) works in ubuntu

I'm using curl and pycurl to connect to a secure 3rd party api and when I use pycurl I'm getting authentication errors back from the server, but when I use curl on the command line and do the same thing it works. I set both to verbose mode and am seeing some differences in the request, but I can't seem to figure out what the error is. T...

When POSTing an associative array with cURL, do I need to urlencode the contents first?

When I assign an array of data to be POSTed as a cURL option (via CURLOPT_POSTFIELDS), do I need to urlencode that data first or will that be taken care of? ...

HTTP Request, loading javascript DOM manipulations that have been made to the HTML

I'm currently using cURL to do HTTP requests, and it works fine. However I need to get the javascript code and execute it in the context of the HTML, making it manipulate the DOM exactly as if it were a web-browser. The first thing that came to mind was to use firefox, there's a command-line interface so I thought it would be easy (mayb...

Making file_get_contents() session aware in PHP

Preamble: My app is mod_rewrite enabled and I have index.php page that downloads vaious pages based on Request_URI and prints them as page content. Problem: File() or File_get_contents() function is excellent at downloading my other app pages. But as soon as I try to use it to download a page that is session enabled, I start having prob...

Hiding IP address using CURL

Similar: http://stackoverflow.com/questions/584272/possible-to-assign-a-new-ip-address-on-every-http-request Is it possible to display a different/spoofed IP address using CURL when you make requests to a server? If not, is there any alternative way of spoofing your IP address using PHP? ...

Improving cURL performance (PHP Library)

Here is a brief overview of what I am doing, it is quite simple really: Go out and fetch records from a database table. Walk through all those records and for each column that contains a URL go out (using cURL) and make sure the URL is still valid. For each record a column is updated with a current time stamp indicating when it wa...

GUI frontend for cURL for testing an API

I'm (manually) testing a RESTful API that makes full use of GET/POST/PUT/DELETE methods. Rather than using cURL on the command line to quickly test different input options, it would be handy if there were a windows GUI application to make this easier. Does anything like that exist? ...

cURL- how to get a response through commandline?

hi i have a client requirement where i should submit an xml file with data and to recive the processed data through poll reponse. i used curl to trasfer the file from commandline to http site. curl -v -d @request1l.xml -H "Content-Type: text/xml; charset=utf8" http://**/ws -o request2.xml . now to get the poll response into an xml wha...

What are the important differences between using fopen($url) and curl in PHP?

I'm writing some code that will need to speak to a web service over HTTP(s). In the past I've used the curl library. Recently, I noticed that I can simply use fopen() to access a remote URL and it seems far simpler. Curl seems to be much more configurable, having a plethora of options. Beyond that configurability, does it matter whic...

Escaping CURL @ symbol with PHP

I'm writing a php application that submits via curl data to sign up for an iContact email list. However I keep getting an invalid email address error. I think this may be due to the fact that I'm escaping the @ symbol so it looks like %40 instead of @. Also, according to the php documentation for curl_setopt with CURLOPT_POSTFIELDS: ...

PHP library or command line?

I have run into two situations lately where I have chosen to use the command line for doing something rather than the PHP library. For example, in PHP doing this: `curl http://someplace.com` instead of this: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.example.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec(...

Why won't MFC::CHttpFile 'PUT' for me?

My code talks to a little Java application provided by a vendor. This Java app sets up a web server at localhost:57000 which is used to control the state of 'the machine'. For the purpose of this question, I need to change the state of 'the machine' from 'off' to 'on'. To make this happen I'm supposed to HTTP PUT the following string ...

Is it possible to get all emails from an inbox in GMail?

Is it possible to get all of my emails from your GMail inbox rather than only unread email? My current PHP script only gets unread email but I want the whole inbox. I am making use of PHP and CURL. Firstly, is it possible to do this? If so, can someone give me some hints on how to achieve this? ...

Programmatic login and use of non-api-supported Google services

Google provides APIs for a number of their services and bindings for several languages. However, not everything is supported. So this question comes from my incomplete understanding of things like wget, curl, and the various web programming libraries. How can I authenticate programmatically to Google? Is it possible to leverage the exi...