Do we have a demo of PHP

Do we have a demo of PHP…
I read the document, but I didn’t quite understand it

Hello @wow,

Can you link me to the document you are struggling with and elaborate a little more on the process or task you are trying to do and I will try to come back with further help for you.

Many thanks,
Paul

1 Like

https://0-www-crossref-org.libus.csd.mu.edu/documentation/member-setup/direct-deposit-xml/https-post/

$header = [
            "Content-type" => 'multipart/form-data',
            "Content-Disposition" => 'form-data'
        ];

        $ch = curl_init();
//        $url = '/servlet/deposit?operation=doMDUpload&login_id=m_name&login_passwd=my_pwd';
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_POST, true);
//        $post_data = ['name'=> 'fname','filename'=> Yii::getAlias('@frontend').'/web/test3.xml'];
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $result = curl_exec($ch);
        curl_close($ch);
        exit();

I tried many times, but the transmission failed

Thanks for the information, can you let me know the username m_name that you are using and I will check a few things to make sure it is setup correctly.

Can you also send me over the error message that you are receiving as well please.

m_name=525642776@qq.com

Great, thank you.

Can you try adding a forward slash and then the username (role) to the end and see if that works. So it would be 525642776@qq.com/deps.

Thank you,
Paul

Thank you. I just tried and still returned false. There is no record of queuing in the background

What is the error message that was returned?

I tested a post in my local environment, and the correct return should be

HTTP/1.1 200 OK
...

But when testing our return, curl always returns

boolean false

So I don’t know what’s wrong now. Thank you for your help

My XML file is correct because I uploaded it successfully with the background management tool.

Checking against the admin console, I see that some test deposits were made using test DOIs. We would not recommend registering test DOIs as these cannot be deleted.

If you need a test login then let me know and I will set something up for you.

The status code 200 OK means that the deposit was received by the system here, when was it sent? I only see two deposits in the submission logs from the 21st February.

Thank you very much for your suggestion.

Can you open the test function for me

I changed the code and resubmitted it to the test server, and a new error message appeared

HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
type Exception report

message Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.crossref.common.servlet.RequestCaptureFilter.doFilter(RequestCaptureFilter.java:139)
root cause
      ...

I have sent an email to the address listed for you to finish setting up the test account now. Complete that section and then add those details into your script and see if that works for you.

Thank you very much. I have received the email and completed the registration.

But prompt ‘wrong credentials Incorrect username or password.’

Did you try to login to the test environment? https://0-test-crossref-org.libus.csd.mu.edu/

You should be able to use the username and password that you setup for that environment.

Let me know if you are still not able to login and I will resend the password reset email again.

1 Like

Yes, I log in to this website
But the account password is incorrect
I applied for resetting my password myself, but no link was sent. It may be troublesome for you to send a link to reset your password

I have sent a password reset link for the test system for you now.

1 Like

Thank you very much. I have logged in to the test account
However, when testing the post function, we encountered the following problems. The request header is based on the document
Name and password are used really

D:\www\deepinscienceV1\common\models\Preprint.php:194:string 'POST /servlet/deposit?operation=doMDUpload&login_id=name&login_passwd=passwd HTTP/1.1
Host: test.crossref.org
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, /
Accept-Language:en-us
Content-Type: multipart/form-data; boundary=--------------------------1646209009
User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)
Content-Length: 45 Pragma: no-cache--------------------------1646209009
Content-Disposition: form-data; name='fname';filename='test3.xml'
<?'... (length=2099)
D:\www\deepinscienceV1\common\models\Preprint.php:195:string 'HTTP/1.0 400 Bad request
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request.
</body></html>
' (length=187)

It has been developed
I love you guys
I’m so happy :grin:

1 Like