/    Sign up×
Community /Pin to ProfileBookmark

cURL need to make it work

hey
i have password .httpaccess protected directory and I need to a access page in that directory. I know i can do that w/ cURL but i’m not sure how to use curl.

Can some one help me out?

Here is the code that i have so far, but I dont think it works ?

[code=php]
<?
echo “Running Access Function<br>”;
$url=”http://xxxxxxxx/xxxxxxxl.php”;

/* fetch the config */
$cm = curl_init();

/* FIX proxy usage: */
curl_setopt($cm, CURLOPT_PROXY, ”);

curl_setopt($cm, CURLOPT_URL, $url);
curl_setopt($cm, CURLOPT_USERPWD, “xxxxxxxxxx:xxxxxxxxxxxx”);
curl_setopt($cm, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_DIGEST);
//curl_setopt($cm, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($cm, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($cm, CURLOPT_RETURNTRANSFER, TRUE);

curl_setopt($cm, CURLOPT_POSTFIELDS, “Submit=Download configuration”);
curl_setopt($cm, CURLOPT_POST, true);

curl_setopt($cm, CURLOPT_VERBOSE, TRUE);
$res = curl_exec($cm);
/*if ($res == FALSE) {
//$this->error = curl_error($cm);
echo curl_error($cm);
curl_close($cm);
return 0;
} else {
$httpcode = curl_getinfo($cm, CURLINFO_HTTP_CODE);
curl_close($cm);
//$this->rawconfig = $res;
echo “cURL ok”;
return $httpcode;
}
*/
?>
[/code]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @alexus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...