Jump to content

test006

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

test006's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=375769:date=May 21 2006, 10:03 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 21 2006, 10:03 AM) [snapback]375769[/snapback][/div][div class=\'quotemain\'][!--quotec--] Good, ok. You tried it the other way and it's not working for you, so you must try a different method. You can't do the same thing and expect it to work. Maybe your code didn't work because you don't show that you used the CURLOPT_RETURNTRANSFER to actually return the data to your $data variable (when cURL is executed). The posting issue has been addressed in this topic: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=90469\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=90469[/a] The site where you can post code temporarily is called: [a href=\"http://pastebin.com\" target=\"_blank\"]http://pastebin.com[/a] Code example: [a href=\"http://pastebin.com/729709\" target=\"_blank\"]http://pastebin.com/729709[/a] Also, if the sites you're accessing is using cookies, you have to account for that too. See this topic: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=93572\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=93572[/a] [/quote] Hi, First of all thanks for all the info. I had another look through my code and it seems that my login code actually logs me into the website but it does not set the cookie in my cookie file. Here is my login script: [a href=\"http://pastebin.com/732774\" target=\"_blank\"]http://pastebin.com/732774[/a] Once i execute the above code i can see that i am logged into the website. When i look at /tmp/cs file i should see the cookie there but it empty. i have given it all the permission i have even done chmod 777.... Now examing the http header that i get back from server is: Set-Cookie: ps_sid=5e1d4348d7e193396c24de759f851158 But i cannot see this in my cs file. In order for my to download the file i need this cookie to be set in the cs file... Thanks
  2. [!--quoteo(post=375644:date=May 20 2006, 10:31 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 10:31 PM) [snapback]375644[/snapback][/div][div class=\'quotemain\'][!--quotec--] Just try it like the code posted in the link provided in my first post here. Open a file first (for output) and use CURLOPT_FILE with the file handle of the opened file. 1) open file for writing. 2) initialize curl. 3) set CURLOPT_FILE with the handle of the file opened for output. 4) Turn CURLOPT_HEADER off (0). 5) Specify the URL using CURLOPT_URL. 6) Execute curl. 7) close curl 8) close file you opened for output. 9) Check the file contents. [/quote] O.K i will give it a try and get back to you... Thanks
  3. [!--quoteo(post=375610:date=May 20 2006, 07:53 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 07:53 PM) [snapback]375610[/snapback][/div][div class=\'quotemain\'][!--quotec--] Your earlier post said that did use it and that's why I responded saying to take it out. It's not my site. Sorry, that you're having problems. I can't remember the sites but there are some that let you post code temporarily and give you a link to the code for posting into forums and such. If you find one of those, then do that. [/quote] Yes i understand its not your site. O.K lets do it another way. I will describe my code and what i am doing. My first code block uses curl to login to the remote website. This works fine i.e. i can login using the curl. Now once i ma logged in i use the URL to get the file from the remote website. URL is something like this: [a href=\"http://www.somewebsite.com/?page=shop/pricelist&print=1&\" target=\"_blank\"]http://www.somewebsite.com/?page=shop/pricelist&print=1&[/a] I use/try curl to download the file from the above URL. so my curl code looks like this I set CURLOPT_HEADER to 0. (I have tried 1 as well) And than CURLOPT_URL to url shown above. Than i do $data = curl_exec($ch) So in theory the file i am trying to get should be stored in variable $data. I to close_curl Now i use fopen to open file and write $data to my file and than close the file. The thing is i do not get anything in my file. So my orginal question was how do i deal with http header sent by server that contains content-disposition:? Beacuse i have used curl before to download files before but the server are not using content-disposition: header. thanks...hope this helps.... i will try to find some hosting website and than post my exact code....
  4. [!--quoteo(post=375603:date=May 20 2006, 07:31 PM:name=mcHenry)--][div class=\'quotetop\']QUOTE(mcHenry @ May 20 2006, 07:31 PM) [snapback]375603[/snapback][/div][div class=\'quotemain\'][!--quotec--] I am trying to use curl however am not having any success with a CLI script. Fatal error: Call to undefined function: curl_init() in C:\PHP4\cli\processweb.php on line 65 Windows XP PHP 4.4.2 php info shows: CURL support enabled CURL Information libcurl/7.14.0 OpenSSL/0.9.8a zlib/1.2.3 Any help would be greatly appreciated. Thanks in advance... [/quote] Hi, I googled the following error "Fatal error: Call to undefined function: curl_init()" and got this web address back. This might be of some use to you. [a href=\"http://www.tonyspencer.com/mt/archives/2003/10/curl_with_php_a.htm\" target=\"_blank\"]http://www.tonyspencer.com/mt/archives/200..._with_php_a.htm[/a] Let me know if this works. If not let me know i have same setup as you and it is working for me. Can you also post your code so i can have look. Thanks
  5. [!--quoteo(post=375601:date=May 20 2006, 07:28 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 07:28 PM) [snapback]375601[/snapback][/div][div class=\'quotemain\'][!--quotec--] Just take out the phpinfo function and you should be able to post it here. [/quote] I do not have phpinfo function in my code. If you mean this: echo "phpinfo()"; I do not have this part of my code..... I have tried different things i.e removing different parts of the code but it still gives me error saying i do not have permission to post on this server. Its a pain. Thanks
  6. [!--quoteo(post=375494:date=May 20 2006, 08:35 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 20 2006, 08:35 AM) [snapback]375494[/snapback][/div][div class=\'quotemain\'][!--quotec--] This forum has been doing that sometimes. I tried to post code on another post and got the same thing. But when I took off phpinfo function it allowed me to post. So, it seems some things aren't allowed to be posted or it just gets confused. You can't PM me because it will do the same thing. Try posting again or just put the code on your serve and provide a link to the source code. [/quote] Hi, When you say phpinfo you mean phpinfo() as part of my code. I do have this part of my code that i am trying to post. I do not have a server thats on the internet that i can use to post my code. All my code is on my local PC which in a private network and sits behind a dynamic public IP address on my router. Can i email you the code? Sorry for the trouble. Thanks
  7. Yes i did look at the link you provided. For some reason when i try to post my code it tells me that i do not have permission to post my message. Is it O.K if i PM you my code. Thanks
  8. [!--quoteo(post=373517:date=May 13 2006, 09:37 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ May 13 2006, 09:37 AM) [snapback]373517[/snapback][/div][div class=\'quotemain\'][!--quotec--] Don't include the header and write out to a file. Something like this code: [a href=\"http://www.weberdev.com/get_example-4009.html\" target=\"_blank\"]http://www.weberdev.com/get_example-4009.html[/a] That code is not perfect but should work. Remember to close the opened file (which the code doesn't do). Also that function doesn't return anything and $local_path is not used. [/quote] Hi, I have tried this, and header is not the problem. When the webserver sends http header with content-disposition i need curl to able to handle this and download the file. The normal browser basically detects this and pops a save the file dialog box. How can i get this with curl. Thanks in advance
  9. Hi all, I am currently using curl(libcurl) in my php to login to a remote website and download a file. Now i have the first part of the script working i.e. i can login to website using my php script but i cannot download the file. I need to use curl since i need to submit username and password as http post. The problem is that when you click on the link to download the file, the server sends the http header which says: [code] HTTP/1.x 200 OK Date: Fri, 12 May 2006 14:04:09 GMT Server: Apache/2.0.54 (Fedora) X-Powered-By: PHP/4.4.0 Expires: 0 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache content-disposition: attachment; filename=testing.xls Connection: close Transfer-Encoding: chunked Content-Type: application/x-octet-stream [/code] How do i deal with content-disposition header with curl? Can anyone help me? When is normal browser you can a dialog box which promts you to save the file on your harddrive... Thanks in advance....
  10. Hi, In php i want to read the file timestamp which will give me the date and time of the file stored on the file system. How do i get this info using php? i am working on linux file system. Thanks in advnace...
  11. Hi, I have read the following tutorial Including Files in PHP - Beginner Tutorial and i still have some questions. I came across this when working on my current project. I have all my php files under following directory: /var/www/test/code So all my php scripts are under code directory as shown above.... No i want to include files within my php scripts that are from a directory that is not inside /var/www directory. I want to have a include directory that inside /var directory so my include directory is /var/include. My question is how do i include files in my script that are located in a directory that is outside the /var/www directory as in my case this is /var/include directory... Do i need to enable read permissions for my web server to be able to read files from /var/include directory?? Please advise... Thanks for help 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.