cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: Unable to access file or directory with Curl in PHP

From: sriram kumaran <sriram_kumaran_at_hotmail.com>
Date: Tue, 21 Jul 2009 21:58:57 +0530

Hi Liu,Thanks for the response. I did create dir1/dir2/file1 under my Apache www folder.
As per your suggestion, I tried using $POST_URL as localhost. The script still does not work.

I guess the problem has to do with accessing a directory structure/file on the web server of the website. That I am unable to do from my local machine. If it is some URL, then I am able to access the same using cURL

Regards
Sriram

From: me_at_lx.sg
To: curl-and-php_at_cool.haxx.se
Subject: RE: Unable to access file or directory with Curl in PHP
Date: Fri, 17 Jul 2009 11:40:36 +0800

Hi Sriram,

 

This has nothing to do with cURL. Can you check, as per your
error message, that “D:/wamp/www/dir1” exists on your local machine?
I’m guessing that you have placed the dir1/dir2/file1 file under the “test”
directory instead of the document root, so this might work:

$POST_URL = "http://localhost/test/dir1/dir2/file1";

 

With regards,

Liu Shan Shui

me_at_lx.sg

"Life would be much easier if I had the source code."
- Anonymous

 

From:
curl-and-php-bounces_at_cool.haxx.se [mailto:curl-and-php-bounces_at_cool.haxx.se] On
Behalf Of sriram kumaran

Sent: Friday, July 17, 2009 2:04 AM

To: curl-and-php_at_cool.haxx.se

Subject: Unable to access file or directory with Curl in PHP

 

Hi,

I am using Curl to access a webpage and post some data to a form.

The login to the http webpage goes through successfully from curl. Once I am
logged in, I have a form where I fill some data.

Here is where I am facing the problem. The form has the following in it's
action field

<form name="XYZ" action="/dir1/dir2/file1"
method="post">

So, when I fill the fields in the form and try to post, the script does not
work.

I get the following in the Apache error log:

[Wed Jul 15 09:58:04 2009] [error] [client 127.0.0.1] File does not exist:
D:/wamp/www/dir1, referer: http://localhost/test/login.php

I created a dummy directory structure like how the webpage expects, (i.e) I
created dir1 and dir2 in my www folder of apache and then a dummy file called
file1 inside dir2 and executed the script, it still it does not work

When I set my curl options in php, I give something like,

$POST_URL = "http://example.com/dir1/dir2/file1";

curl_setopt($ch, CURLOPT_URL,$POST_URL);

Is there a way to post the details of a form to a directory or file in curl?

Thanks

Sriram

Videos
Get the latest video streams on movies, Try it!

_________________________________________________________________
MSN Quiz The clash is on to find the best brains. Test your skills with avid quizzers on MSN quiz.
http://specials.msn.co.in/WLSocialNetworkConnector/Chrome.aspx

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-07-21