Jump to content

M.O.S. Studios

Members
  • Posts

    307
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

M.O.S. Studios's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

5

Community Answers

  1. Hey everyone, I changed the service I use for my e-mail hosting away from my website hosting. The only "email thing" I really use the hosting service for is sending emails, for reason explained below. Usually, I would have changed the SMTP settings using php.ini, and been done with it, however, my shared hosting has removed that ability. This has created two unique problems: 1. Now that my my email is handled by a third party, the hosting no longer DKIM signs emails it sends out using "mail()" 2. The "header from" and the "envelope from" no longer match by default. The ladder is the default shared hosting domail email. These two issue resault in the mail going into the spam folder. I can fix this by using either the phpmailer library, or the -f parameter in mail; however that now means compatabilty issues with future applications I install, that depend on the php.ini information being accurate. Is there any workaround you guys can think of that might help me fix this?
  2. No the idea is, if I send or receive email from a email with pgp the php script does nothing. if I receive an email from someone who doesn’t, the php script will encrypt it on my server. if I sent it to someone that doesn’t have it, it will send a plain text email, then encrypt the local copy.
  3. Hey Everyone, I am using a host that uses Cpanel/GNUpg. From what I can tell, any email sent to me using PGP/GPG is stored on my server as encrypted. If the sender didn't use encryption, it is saved as plain text. I know I can pipe my emails through a PHP script. Does a PHP script/library exist that will automatically encrypt any plain text emails using my public key, before passing them to my email client? Thanks
  4. So, after giving up on the documentation I gave postman.com a gander. All the parameters are supposed to be sent within the URL, and the file as the only information in the post field. They also allow you to send plain text, and they will encode it for you. So here is what I did: $uploadPath = str_replace("/".basename($args['uploadPath']), '', $args['uploadPath']); $accessToken = getPcloudToken(); $query = array('filename'=>'file.csv', 'nopartial'=>'1', 'path'=> $uploadPath); $product_data = $args['product_data']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.pcloud.com/uploadfile?'.http_build_query($query)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $product_data); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Authorization: Bearer '.$accessToken)); curl_exec($ch); curl_close($ch); I was able to take the whole temp file creation out. so that was nice
  5. Can anyone make heads or tales of this? I am playing around with pCloud. The Pcloud file upload documentation is kinda vague. they don't explain where or how to attach the file, just how to name it, and where to put it. They even have instructions on how to send it as binaries. but that is also kind of vague. Can someone see what I am missing? This code is supposed to take a string, create a temp file, and then upload it. at the moment, it uploads a file with the right file name, but only contains two dashes $uploadPath = 'uploadpath'; $accessToken = AccessToken; $product_data = fopen('php://memory', 'r+'); fputs($product_data, 'content string'); rewind($product_data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.pcloud.com/uploadfile' ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, array('filename'=>'test.csv', 'data'=>$product_data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data', 'Authorization: Bearer '.$accessToken)); $result = curl_exec($ch); var_export(curl_error($ch)); var_export($result); curl_close($ch);
  6. Thanks for the reply. I only changed the URL from the OwnCloud host to the new one. When I ran the terminal, it worked perfectly. I rebooted and tried from a private browser that doesn't keep the cache. When I did it from the terminal, I did it from port 80, and it worked
  7. Hey everyone, Here is a bit of a weird one. I set up ownCloud using a PAAS service and it is running well. However, when I try to use curl from PHP, I keep getting an error that says "Failed to connect to THEURL port 80: No route to host" This is weird for two reasons. 1. I also tried uploading it from my computer's terminal, using curl, and that 2. Until about a day ago, I had my own cloud on a shared host, and the PHP code worked just fine. Here is the PHP code I used: function uploadToOwncloud($args = array()){ $uploadPath = $args['uploadPath']; $product_data = fopen('php://memory', 'r+'); fputs($product_data, $args['product_data']); rewind($product_data); $user = $args['user']; $pass = $args['password']; $url = "MYOWNCLOUDURL.COM/remote.php/webdav" .urlencode($uploadPath); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass"); curl_setopt($ch, CURLOPT_PUT, 1); curl_setopt($ch, CURLOPT_INFILE, $product_data); curl_setopt($ch, CURLOPT_INFILESIZE, fstat($product_data)['size']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary $curl_response_res = curl_exec ($ch); var_export(curl_error($ch)); return; } Here is the terminal command I used: curl -u "user:password" -T test.txt "http://myowncloudurl.com:80/remote.php/webdav/text.txt" I tried adding my domains to the whitelist, and turning off the fire wall Thanks
  8. Hey guys, I have a script I’m working on, and I was curious if I can do the following: 1. user clicks button on browser, that sends a request to the server using ajax 2. the server creates a zip file and stores it in php://memory 3. the browser get the needed information to initiate a download of the zip file. can this be done? I suspect I have to physically save the file on the server, and delete it after; which I would like to avoid
  9. Hey everyone, I am trying to take information from a DB and convert it into a string that has CSV values. some of the values have commas and double quotes, which messes up the end product. is there a way to escape the string so it is rfc 4180 compliant? I don’t want to create a file. I know I can use str_putcsv along with php://temp; but ideally I wouldn’t do that. Mostly because my shared hosting has issues php://temp thanks in advance!
  10. I might have worded it wrong. I want it so that if any of those three methods have an exception, it will bubble up to the try/except in the _construct method. for example: class myclass{ public function func1(){ //line of code that creates fatal error } function __contruct(){ try(){ $this->func1(); }catch(Exception $e){ echo "found a error"; } } } the above will work only if the exception is thorwn within the scope of func1(). if func1() calls an external function that throws an exception, it wont catch it. It doesn't "bubble up". if I change it to: class myclass{ public function func1(){ try(){ buggyFunc(); }catch(Exception $e){ throw new Exception($e); } } function __contruct(){ try(){ $this->func1(); }catch(Exception $e){ echo "found an error"; } } } this works. The problem is, if you look back to my original example: I don't want any subsequent functions to run if the previous function had an error. At the same time, I don't want to a script filled with "try/catch/throw" commands
  11. Hey Everyone, Odd question. I am working with a class that runs methods when a new instance is created. Is there a way to catch any errors thrown within the methods? Here is the code: function __construct(){ try{ $this->val1 = $this->func1; $this->val1 = $this->func2; $this->val1 = $this->func3; }catch(Exception $e){ $this->notes($e); $this->errors = true; } } Ideally, if method "func1" throws an error at anypoint within it, then it will be caught by "catch" in _construct. Is this possible, or do I need to add "try/catch" to each method?
  12. This looks awesome! Probably just what I need. stupid question: I’m on shared hosting with no terminal. So that means no composer. Do you think I can install this another way?
  13. Hey Everyone, I am working on a short script that transfers information from one source to another. Both have a ReST api. I was curious if anyone knew any resources that can make that easier. Ideally, it would be a php file I can use to make an object for each API? Any ideas?
  14. function spamTest($header){ $output_array = preg_grep('/^(X-Spam-Score:)\s([-+]?\d{1,3}\.\d)?/i', explode("\n", $header)); list($xSpamScore, $score) = explode(": ", $output_array[array_key_first($output_array)]); return ($score < 5); } I ran the email header into this and it seems to work.
  15. Ok! So I have been doing the following research: I watched this video to understand how these protocols work I took a look at the headers you posted I sent my php script some real, and spoofed emails I now have a better understanding of what you were explaining to me. My email server does all the checking for me and puts the results into the header of the email. All I need to do is create a php script that checks the headers to see if it passed. Thus the regex code. Is that correct?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.