Jump to content

Inspector Mills

New Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Inspector Mills's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Thanks for the feedback. It turned out that the authentication was what was getting me stuck. This is what eventually worked: <?php $order = “[API order no]"; $data = http_build_query(array("order[status]" => "S")); $email = “"; $password = “[password]"; $url = "[API URL]/$order"; $ch=curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($ch, CURLOPT_USERPWD, "$email:$password"); curl_setopt($ch, CURLOPT_SSLVERSION,3); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); curl_close($ch); ?> Regards Mills
  2. Hi there I need to use cURL to change the status of an order on a Restful API using PHP. The instructions I received from the developers of the API is as follows: curl -X PUT \ -d "order[status]=S" [site url] In addition to this, they informed me that it is necessary to be signed in, with the credentials supplied. So, my problems are these: 1. what is the syntax for the PUT action in PHP cURL? 2. how do I sign in to the site with PHP? Any guidance will be appreciated Thanks.
  3. Hi there I need a PHP script to extract a number of lines from a text file, and insert them into an array. The lines that I need to extract all have the following in common: - the line preceding it has a line of dashes, preceded by 4 spaces ; - the line after it is blank, and then is followed by another line of dashes (with no preceding spaces). Like this: ---------------------- Total : 26.225 % -------------------------- Any suggestions on how to do this? Thanks in Advance. Mills
  4. Hi there We are hosting a web server that requires large files (100MB+) to be uploaded to it. We are using PHP upload scripts, and it is working, but we are getting complaints that the uploads are unreliable (some files fail to upload, with no error messages). I have been reading on various forums that FTP should rather be used for larger files, rather than HTTP. But from what I can see, there are some limitations, and I was wondering if there are any ways around these: - Using cURL would mean that the files would first be uploaded to a temp folder on the web server via HTTP, and then only sent via FTP. This defeats the purpose, because if it is already on the Web Server (which is hosted locally), then I might just as well move the file. - Using the built in FTP functionality of PHP, it appears that ones needs to know the full path of the source file. The users who are uploading files are accessing the Web server via a form in a browser, which will not give the PHP script the full path of the file to be uploaded. All we want is to have a reliable means for an end-user to access a site with a browser, fill in a form, choose a file to upload, and submit it. Additional functionality, like a progress bar, the ability to select multiple files and a resume option for failed uploads, would all be very nice. But the main concern is that the transfers be more reliable. Thanks for any advice. Mills
  5. I have since discovered that I cannot use the batch file in my third-party hotfolder, because I cannot find a way of getting the batch file to read the contents of the specific file (the XML file) that is triggering the batch action. Even if I could, I would need for PHP to read the contents or, more accurately, extract the contents of this file for POSTing. The chances are there are going to be a number of files waiting in this folder, so PHP would need to know which one to look at. Which takes me back to having a folder "polled" by another application that can trigger the PHP action. Someone suggested CRON - I will investigate this as an option. Another potential problem comes to mind, though - the file would need to be deleted once the action has been called on, otherwise it would repeat the action indefinitely. Thanks for your assistance - it is probably quite evident that I am a bit out of my depth here!
  6. Hi there I have a strange request, and am not sure if it will be possible. I need to be able to POST XML data to a url, that will be extracted from a document. I have read up a little, and have found that both extracting data from a document, and POSTing to a url is possible in PHP. However, the problem that I have is this: I do not know how to trigger the PHP action. I am using a hotfolder-based application to generate the XML file, which places the XML document into a specific folder. I need for PHP to act on the file when it arrives in that folder, and automatically POST the data to the necessary url. In a sense, I need the folder into which the XML files are being saved, to be some kind of "hotfolder" which will be polled or "watched" by an application, and kick into action once a file arrives in that folder. The reason I mention that I am using a hotfolder-based application, is that it is possible that I create a custom hotfolder which will trigger a batch file when a file arrives in the folder that is being watched. I can make this batch file to do whatever I need to. In other words, a possible solution would be to have a batch file trigger the PHP action. Again, I do not know if this possible with a batch file, or how do do it if it is. Any guidance would be appreciated.
  7. Hi there I am pretty new to Apache and PHP, so please be patient with me. I have installed the 64 bit version of Apache and PHP, and I cannot get the APC extension to work. The reason I need it is to be able to get a progress bar running for uploading files. Please help, if you can, with: - a way of getting APC to work; or - an upload progress bar that doesn't require APC. Thanks in advance.
×
×
  • 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.