2

Can someone help me to form this commndline request in PHP ?

$ curl -u [USER:PASSWORD] https://subs.pinpayments.com/api/v4/meresheep/subscribers/7388.xml

I have tried the following and getting only 'false' returned...

 // Query the user to pin payments for the details...
 $curl_url = "https://subs.pinpayments.com/api/v4/xyz-site/subscribers/32.xml";

 //open connection
 $ch = curl_init();

 //set the url, number of POST vars, POST data
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: -u [USER:PASSWORD]'));

 //execute post
 $result = curl_exec($ch);
 curl_close($ch);
0

1 Answer 1

1

You need to change the CURLOPT_HTTPHEADER line:

curl_setopt($data, CURLOPT_HTTPHEADER, array(
    'Authorization: Basic ' . base64_encode('username:password')
));
Sign up to request clarification or add additional context in comments.

2 Comments

Hello David, Thanks for your reply... i tried in that way too... it is returning 'false' only... But when i access the URL via browser... it asks for username & password and when i entered the username mentioned above and hit enter and it shows me the proper output i wanted on screen... The funniest thing is the same CURL code is working perfectly in my localhost. Is there any additional param that i may have to pass along ?
You could try outputting the error with echo curl_error($ch); after the curl_exec() line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.