grjoseph Posted February 3, 2023 Share Posted February 3, 2023 Hello, I am having some issues on how to retrieve a chunked CSV file sent to my callback URL. this is what is being sent to by callback URL Method: 1 POST Headers: 1 content-dispositon: form-data; name="file"; filename="dipa1b2c3.csv" 2 transfer-encoding: chunked 3 content-type: application/csv Body: 1 <bytes of the CSV> if I set the callback url to receive the POST to request catcher I see all the stuff in there but from PHP I dont know how to get the actual contents of the CSV file being sent to me. this is what request catcher sees. POST /?bulk_dip_task[id]=01GQJAYVE75QE6QE1J1P3F892D&bulk_dip_task[reference_id]=Test-LRN-Lookup&on_done_action[id]=01GQJAYVE7NDP25KRBWVHC1QYQ&on_done_action[type]=send HTTP/1.1 Host: nuvana.requestcatcher.com Transfer-Encoding: chunked Content-Type: multipart/form-data; boundary=------------0185E4AF6EF0E2670003B558416EC8F4 User-Agent: mercury-bulk-dip-task-worker/1.0 X-Mercury-Bulk-Dip-Task-Id: 01GQJAYVE75QE6QE1J1P3F892D X-Mercury-Bulk-Dip-Task-Reference-Id: Test-LRN-Lookup X-Mercury-On-Done-Action-Id: 01GQJAYVE7NDP25KRBWVHC1QYQ X-Mercury-On-Done-Action-Type: SEND 265 --------------0185E4AF6EF0E2670003B558416EC8F4 content-disposition: form-data; name="file"; filename="dip-01GQJAYVE75QE6QE1J1P3F892D.csv" transfer-encoding: chunked content-type: application/csv Status,LRN,MessagingEnabled,CDRID,PhoneNumber,ErrorCode,SwitchName,RateCenter,OCN,LATA,CarrierType,CarrierName COMPLETED,12893170001,false,01GQJAYVQ3XHCRW9B0QET3HWX8,19057225234,OK,SUTTON,SUTTON,082E,888,CLEC,Distributel Communications Limited COMPLETED,16475800002,true,01GQJAYVQ33KBHQ8JM7C4SD6VY,14169922312,OK,TORONTO,TORONTO,8303,888,PCS,TELUS Mobility --------------0185E4AF6EF0E2670003B558416EC8F4-- 0 from my PHP application when I read the $_Get I see this 23:02:03 09:25:47 - received_GET - key: bulk_dip_task - Value: Array 23:02:03 09:25:47 - bulk_dip_task - key: id - Value: 01GRBTPH4W4TCPTQQ0GK2X8R39 23:02:03 09:25:47 - bulk_dip_task - key: reference_id - Value: Test-LRN-Lookup 23:02:03 09:25:47 - received_GET - key: on_done_action - Value: Array 23:02:03 09:25:47 - on_done_action - key: id - Value: 01GRBTPH4WXBJV35HM1AN6STEM 23:02:03 09:25:47 - on_done_action - key: type - Value: send I need to be able to get the content sent back and I am not sure how to do that, i tried many different things and no luck...can any one help out. to recap, I have a callbak URL that is being used to POST a chucked CSV file to. if I use request catcher as my callback URL it shows me everything but I dont know how to receive everything in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/ Share on other sites More sharing options...
requinix Posted February 3, 2023 Share Posted February 3, 2023 That looks like a regular ol' file upload. Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605351 Share on other sites More sharing options...
grjoseph Posted February 3, 2023 Author Share Posted February 3, 2023 I know...but file_get_contents('php://input'); etc does not work. not sure what is wrong. Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605352 Share on other sites More sharing options...
grjoseph Posted February 3, 2023 Author Share Posted February 3, 2023 (edited) I checked and there is nothing in $_Files. so not sure why PHP is not seeing it where request catcher can. I thought I read about some kind of bug in apache if the content length is not set in the headers.... if ( !isset($_FILES['upfile']['error']) || is_array($_FILES['upfile']['error']) ) { throw new RuntimeException('Invalid parameters.'); } I get invalid parameters. Edited February 3, 2023 by grjoseph Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605355 Share on other sites More sharing options...
requinix Posted February 3, 2023 Share Posted February 3, 2023 Where you are getting "upfile" from? I don't see that anywhere in the sample request you showed. The actual name was content-disposition: form-data; name="file"; filename="dip-01GQJAYVE75QE6QE1J1P3F892D.csv" "file" Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605357 Share on other sites More sharing options...
grjoseph Posted February 3, 2023 Author Share Posted February 3, 2023 sorry, typo on my part. I did that as a test....upfile is 'file' still same result though. Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605360 Share on other sites More sharing options...
ginerjm Posted February 3, 2023 Share Posted February 3, 2023 (edited) Forget what I asked.. It's not a normal html file upload. Edited February 3, 2023 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605361 Share on other sites More sharing options...
requinix Posted February 4, 2023 Share Posted February 4, 2023 12 hours ago, grjoseph said: sorry, typo on my part. Then let's go back to the beginning: What did the "request catcher" capture? What is your current PHP code? Quote Link to comment https://forums.phpfreaks.com/topic/315876-how-to-read-body-content-of-a-chucked-csv-file-sent-to-me/#findComment-1605367 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.