curl

cURL: from PHP to BASH

Hi.. I've never done any curl before so am in need of some help. php: <?php $ch = curl_init(); $data = array( 'uptype'=>'file', 'file'=>'@'.$argv[1], ); curl_setopt($ch, CURLOPT_URL, 'http://my_site_ex/up.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); curl_clo...

How to enable curl, installed Ubuntu LAMP stack ?

I have installed ubuntu Lamp stack.But the curl is not enabled neither i can find extension listed in the INI file, i added manually but it didn't worked too. How should enable Curl then ? ...

logins with cURL

I'm looking to use cURL to login to Blackboard, a course management system used a many universities. (For example, http://blackboard.unh.edu) How would I do this? Blackboard uses HTTPS certificates and cookies too I believe. Thanks! ...

How to Get a Webpage's contents without CURL ?

I need to get webpage's content ,I cant use Curl as it is not enabled.I tried the below code But it is not working. $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); $fp = fopen($_GET['url'], 'r', false, ...

PHP: Simulate a <form> tag with POST data and also redirecting the user...

Hi, I have been scouring the internet for a way to do this with no luck :( Basically, it's easy to make a form in HTML with a submit button and some data, and send it to a URL. With this you send the POST data and also the user is taken to the page. I know you can send POST data using cURL and get a response back in PHP but how do I ta...

Delayed responses for cURL SSL PUTs/POSTs (php) (NSS vs OpenSSL)

I have two Fedora-based apache webservers making the same SSL PUT/POST calls with php/cURL. One works fine, but with the other the call succeeds but takes a VERY long time to return a response (~10 min). (GETs don't seem affected) The working server's cURL uses OpenSSL for SSL, while the non-working version uses a later version of cURL ...

PHP curl timing mismatch

I am running a php script that: queries a local database to retrieve an amount executes a curl statement to update an external database with the above amount + x queries the local database again to insert a new row reflecting that the curl statement has been executed. One of the problems that I am having is that the curl statement ta...

curl data array post +multipart/form-data

hi experts, i got stuck during my project, need bit of your advice to find correct path. here is what i am doing in my php code. 1)my script create account on third party website(i have no control over this website) 2)there are 5 forms which i have to submit one by one to create account. 3)ii have successfully created code to submit f...

PHP fsockopen to curl conversion

i have this piece of code: <?php $host = "registration.mypengo.com"; $request = "/webregistration.aspx?taskaction=serviceresponse&partner=157&subid=" . $subid . "&msisdn=" . $msisdn . "&type=TEXT&data=" . $data . "&serviceid=" . $service_id; $fp = fsockopen($host, 80, $errno, $errstr, 3.0); if($fp) { fwrite($fp, "GET $request HTT...

PHP curl post parameters not passed to server

<?php $data = array('name' => 'Ross', 'php_master' => true); $url="http://localhost/test.php"; $handle = curl_init($url); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $data); curl_exec($handle); ?> The $_POST variable on the server side is empty. I also tried using Java servlet; request.getParame...

How to handle "100 continue" HTTP message ?

Hello, I'm writing a simplistic HTTP server that will accept PUT requests mostly from cURL as client and I'm having a bit of an issue with handling the "Expect: 100-continue" header. As I understand it, the server is supposed to read the header, send back a "HTTP/1.1 100 Continue" response on the connection, read the stream up to the v...

PHP: Check if URL redirects?

Hi everybody, I have implemented a function that runs on each page that I want to restrict from non-logged in users. The function automatically redirects the visitor to the login page in the case of he or she is not logged in. I would like to make a PHP function that is run from a exernal server and iterates through a number of set URL...

How to grep curl -I header information

Im trying to get the redirect link from a site by using curl -I then grep to "location" and then sed out the location text so that I am left with the URL. But this doesn't work, it will outputs the URL to screen and doesn't put it test=$(curl -I "http://www.redirectURL.com/" 2> /dev/null | grep "location" | sed -E 's/location:[ ]+//g'...

Use referrer info to get image from url

Hi I want to get image from another site but I requires referrer information to show image. image address is: http://www.foo.com/hist.gif?21918+201020 this adress show gif image if you came this page from foo.com Think I can do this with curl but I don't know how to do this. I have to show image with img tag ...

Download file attached to header with Curl and Php

Hi I'm connecting to a website daily to collect some statistics, the website runs .net to make things extra difficult. What i would like to do is to mechanize this process. I go to http://www.thesite.com:8080/statistics/Login.aspx?ReturnUrl=%2Fstatistics%2Fdataexport.ashx%3FReport%3D99, (the return url is /statistics/dataexport.ashx?Re...

How do I get header from a PHP download page?

Hi, I have a PHP download page. When i submit a form to the page, it prompts a download window (save,open,run..). How do I get header of the download page in php? I tried to use curl, but the result was empty. $post_data = "var=value"; $agent = curl_init(); curl_setopt($agent,CURLOPT_URL,MY URL); curl_setopt($agent, CURLOPT_POST, true...

I want to query whitepages.com 4,000 times, how to save the results?

I have an old customer list of 4,000 businesses. I want to determine if the phone numbers associated with each listing are still working (and therefore the business is probably still open). I can put each number in whitepages.com and check them one by one... but want to automate the results. I have looked at their API and can't digest i...

Using CURL with Google

I want to CURL to Google to see how many results it returns for a certain search. I've tried this: $url = "http://www.google.com/search?q=".$strSearch."&amp;hl=en&amp;start=0&amp;sa=N"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);...

Is [manipulating Craigslist postings with PHP] possible?

Hey everyone, I have a quick question. I want to build a web app for myself that will allow me to post stuff to Craigslist and retrieve postings from Craigslists. I am not doing this to spam Craigslist, I am just doing it to learn. My question is: Is this possible? If so, will knowing PHP be enough? Or will I also need to know how to use...

Get specific content out of an URL read using CURL

How can I get specific content out of a URL fed into CURL? I'm unsure as to how to begin doing this, and haven't been able to Google for it properly since I don't know exactly what I'm looking for. ...