|
For your information, I doubt anyone on this forum is gonna click a link for a file from a person they don't know.
Anyway, what is preventing you from opening the file? Is it encrypted?
Even Notepad* is able to open PHP files:
- Right-click on the file, point to "Open with..."
- Select "Notepad" from the list (if it is not visible, click "Choose standard application" and find Notepad in the list)
If that doesn't solve your issue, you're going to have to elaborate a bit.
*Instead of Notepad, I recommend Notepad++[^] which is a great text editor with line numbering, syntax coloring and a lot of other neat features.
|
|
|
|
|
<?php
$to = "someone@domain.com";
$subject = "Test";
$message = "Hello";
$from = "someonelse@domain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox....
(obviously the mail $to email is the one i am only using for this forum post )
i have asked the server support team and they say that this should work?
any ideas what else to try ...
|
|
|
|
|
I have a similar setup and I don't see anything wrong with what you have, so unless I'm blind it looks like it should indeed work. In fact what you have is almost identical to the php documentation.
Are you sure the server email system is working and has the correct settings in the php.ini file?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP?
could i send the information to another website easily or ?
|
|
|
|
|
|
look for class.smtp.php from Chris Ryan.
that s good one for start to send mails using your smtp server.
|
|
|
|
|
class SafeEmail<br />
30 {<br />
31 function create($user, $host, $suffix)<br />
32 {<br />
33 $at = "@";<br />
34 $dot = ".";<br />
35 <br />
36 $start = $user . at . $host;<br />
37 $end = $dot . $suffix;<br />
38 $address = $start . end<br />
39 <br />
40 return $address;<br />
41 }<br />
42 <br />
43 $se = new SafeEmail();<br />
44 $se->create($user, $host, $suffix);<br />
45 }
More php email scripts listed on the page!
|
|
|
|
|
I have few urls like
http://www.mydomain.com/statecode1-folder1
http://www.mydomain.com/statecode2-folder1
I want to redirect it to http://www.mydomain.com/folder1/ page but I want to show on browser url the original urls likes
http://www.mydomain.com/statecode1-folder1
http://www.mydomain.com/statecode2-folder1
Please note that I do not have folders statecode1-folder1 and statecode2-folder1
Currently I use the below .htaccess which redirects but it changes the address bar
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/ statecode1-folder1 $
RewriteRule ^(.+) / folder1 [L]
RewriteCond %{REQUEST_URI} ^/ statecode2-folder1 $
RewriteRule ^(.+) / folder1 [L]
Thanks in Advance
Regards
Salman Ansari
|
|
|
|
|
Why the below code doesn't upload file to http://xyz.com/uvw/upload_data.php[^] automatically ?
I get error = uploaded file is either missing, empty or was not uploaded via the POST method
But am sure uploading file is not missing or empty as i have echo it and i think i am uploading via post method ?
function datapost($URLServer,$postdata)
{
$agent = "Mozilla/5.0";
$cURL_Session = curl_init();
curl_setopt($cURL_Session, CURLOPT_URL,$URLServer);
curl_setopt($cURL_Session, CURLOPT_USERAGENT, $agent);
curl_setopt($cURL_Session, CURLOPT_POST, 1);
curl_setopt($cURL_Session, CURLOPT_POSTFIELDS,$postdata);
curl_setopt($cURL_Session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL_Session, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($cURL_Session);
return $result;
}
$postdata = array();
$postdata['Id'] = '12340';
$postdata['profileName'] = 'tsunami';
$postdata['file'] = file_get_contents('http://www.abc.co.uk/def/ghi.csv');
$postdata['submit'] = urlencode('submit');
$source= datapost("http://xyz.com/uvw/upload_data.php",$postdata);
Any suggestion devs ??
|
|
|
|
|
Hi,
You need to set CURLOPT_HTTPGET to false explicitly - the PHP documentation doesn't make this clear.
curl_setopt($cURL_Session, CURLOPT_HTTPGET, FALSE);
Niall
|
|
|
|
|
Thanks,
I added the line you said but still getting the same error ..
Anything else i can add/edit to make it working ?
Cheers
|
|
|
|
|
No - that works on my system, as long as the CSV file isn't too big. (OK with 150k, not with 30M)
This is the version of your code I tried out.
<?php
function datapost($URLServer,$postdata)
{
$agent = "Mozilla/5.0";
$cURL_Session = curl_init();
curl_setopt($cURL_Session, CURLOPT_URL,$URLServer);
curl_setopt($cURL_Session, CURLOPT_USERAGENT, $agent);
curl_setopt($cURL_Session, CURLOPT_HTTPGET, FALSE);
curl_setopt($cURL_Session, CURLOPT_POSTFIELDS,$postdata);
curl_setopt($cURL_Session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL_Session, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($cURL_Session);
return $result;
}
$postdata = array();
$postdata['Id'] = '12340';
$postdata['profileName'] = 'tsunami';
$postdata['file'] = file_get_contents('http://localhost/tmp/test.csv');
$postdata['submit'] = urlencode('submit');
$source= datapost("http://localhost/tmp/posthere.php",$postdata);
echo $source;
?>
My test posthere.php is
<?php
foreach($_POST as $k=>$v)
{
echo "$k => ".strlen($v)."<br/>";
}
?>
|
|
|
|
|
Niall Barr wrote: (OK with 150k, not with 30M)
Initially i thought this could be the case as i was uploading around 12mb csv but then i tried with just 4kb but still getting the same error.
I don't really understand what could be the problem - the uploading works fine if i try using normal html form submit but as we don't want to manually browse the file - we decided to go this route and it's not working.. What a pain.
On the other hand why do you say it will not work for size in MB ? Is there any other auto upload way for such big files ?
|
|
|
|
|
I think the only issue was the amount of memory available to PHP on my dev box. I tried with a file that was too big for it.
Are you able to get the other post data transferred if you comment out the file_get_contents line?
Niall
|
|
|
|
|
Niall Barr wrote: Are you able to get the other post data transferred if you comment out the file_get_contents line?
I can't test that as it's some external company site where we have to upload our data so that they can do what they are suppose to do with the data.
Well i use below code as initial request - so they receive the post data and they send us back id which we need to send along with the file -
function datapost($URLServer,$postdata)
{
$agent = "Mozilla/5.0";
$cURL_Session = curl_init();
curl_setopt($cURL_Session, CURLOPT_URL,$URLServer);
curl_setopt($cURL_Session, CURLOPT_USERAGENT, $agent);
curl_setopt($cURL_Session, CURLOPT_POST, 1);
curl_setopt($cURL_Session, CURLOPT_POSTFIELDS,$postdata);
curl_setopt($cURL_Session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL_Session, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($cURL_Session);
return $result;
}
$postdata = array();
$postdata['profileName'] = 'tsunami';
$postdata['tName'] = 'abc';
$postdata['langCode'] = 'en_GB';
... etc
$source= datapost("http://xyz.com/uvw/upload_meta.php",$postdata);
</pre>
It using the same process - so am sure it's only file auto upload bit that's not working for us. As i said it works using normal html form submit.
|
|
|
|
|
It occured to me that it's likely that the site you're posting to expects an attached file rather than the file content in a post field called file...
If that's the case, then this code should work.
<?php
function datapost($URLServer,$postdata)
{
$agent = "Mozilla/5.0";
$cURL_Session = curl_init();
curl_setopt($cURL_Session, CURLOPT_URL,$URLServer);
curl_setopt($cURL_Session, CURLOPT_USERAGENT, $agent);
curl_setopt($cURL_Session, CURLOPT_POST, 1);
curl_setopt($cURL_Session, CURLOPT_POSTFIELDS,$postdata);
$result = curl_exec($cURL_Session);
curl_setopt($cURL_Session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL_Session, CURLOPT_FOLLOWLOCATION, 1);
return $result;
}
$postdata = array();
$postdata['Id'] = '12340';
$postdata['profileName'] = 'tsunami';
$tmpfile = tempnam(false,'tmp_');
$filedata = file_get_contents("http://localhost/tmp/test.csv");
file_put_contents($tmpfile, $filedata);
$postdata['file'] = "@$tmpfile";
$postdata['submit'] = urlencode('submit');
$source= datapost("http://localhost/tmp/posthere.php",$postdata);
unlink($tmpfile);
echo $source;
?>
|
|
|
|
|
great ... this worked like a charm
Thanks a ton. 
|
|
|
|
|
Hi all,
All the while i use to develop PHP app from scratch. Now i thought using standard php framework will be good for better maintenance and support from my teammate. I wonder which PHP framework is good for enterprise application like ZOHO and which php framework is good for normal cms app.
Thanks
|
|
|
|
|
CakePHP is a rapid development PHP framework that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.
Hopefully can help you!
Best regards!
Chiry.
|
|
|
|
|
Thanks Chiry, will you recommend Cakephp as well for simple php application development?
|
|
|
|
|
Hi,
Recently there was a problem with my comments posting form, any one post any thing. I want to restrict some of those can any one help me with this. people were misusing this.. were can i find some code ... to restrict some of the options...
www.bharatdesi.com
Thanks in advance...
|
|
|
|
|
Hi,
Can do it in many ways
1. Add captcha image
2. Ask users to first register with the site
3. Set it in a way where the Admin needs to check each and every comment and approve them
Based on which one or a combination you select, the required code will change. Check what CMS are you using in your site. If it is a popular CMS, then there should be plenty of plugins for you to use.
|
|
|
|
|
in addition to what shamly said, I can also add a vote up/down on comments. This allows users to vote down comments that are offensive. Once a comment gets a certain number of down votes to up votes it is hidden, with an option to show it.
This allows your user base to monitor others. Yahoo News uses a system like this.
Chris J
www.redash.org
|
|
|
|
|
I agree with chris. Vote up/down on comments is another option, specially if you have an active community.
|
|
|
|
|
take a look at www.intensedebate.com[^]. very easy javascript plugin, and they seem to have thought of everything.
|
|
|
|
|