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

curl-and-php

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

From: Liu Shan Shui <me_at_lx.sg>
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!
<http://video.msn.com/?mkt=en-in>

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