Link to home
Start Free TrialLog in
Avatar of Ok123
Ok123Flag for Belgium

asked on

Translating Curl or a Wget instruction to php code

Hello,
I received two  urls to receive à .csv file.
I need to do the php code to insert the procedure in a webpage to download a .csv file

Please find the url :
Wget :
wget 'http://LOGIN:PASSWORD@export.mywebsiteurl.be/redirect.jsp?exportFormat=CSV&exportEncoding=utf-8&compressed=1&category=-1'
or
curl -L -u LOGIN:PASSWORD -O 'http://mywebsiteurl.be/redirect.jsp?exportFormat=CSV&exportEncoding=utf-8&compressed=1&category=-1'

Could you help me to make a simple php code.

Regards
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Eddie, good suggestion!  It wasn't clear to me whether the URL would work as written, and without any way to test we're at a bit of a loss.
Avatar of Ok123

ASKER

Hi Ray, Hi Eddie,

Thank you for your replies.
I can send you the real url, the login and the password in a private message to test.
I need just to avoid sending that kind of informations in public.

Let me know is it ok for you Ray.
Regards
Yes, it is OK, and I'll be glad to help. You can find my email address in my profile.
https://www.experts-exchange.com/members/Ray_Paseur.html
I didn't get any message from you.  Please tell us: How did you handle the login and password?  Thanks!
I think you should have split the point more towards Ray's answer...Ray, I think they can be reassigned, correct?
@Eddie: thanks.  Points can be reassigned, but I have plenty of points and don't worry about that stuff any more.  

However I would very much like to see the Author's solution with regard to the credentials!  It seems like something worth adding to my teaching library.
Avatar of Ok123

ASKER

Hi Ray,

I just sent to you an email because i am traveling right now.
May i ask you how to add your solution in your teaching library as you asked  ?
Regards,
Olivier
I keep a teaching library of examples on my own server.  These are often the responses to common questions here at E-E and in classes I teach about PHP.  

The way to present the authentication credentials for the site -- That's what I'm trying to discern.  Did you use CURLOPT_USERPWD or LOGIN:PASSWORD in the URL?  Did either or both work?  Just trying to keep learning :-)

Thanks and regards,
Ray