How to Use CURL GET info from POST Request – Is It Possible? or Can You Retrieve CURL GET info from P

20 Replies, 1733 Views

"Can You Retrieve CURL GET info from POST Request? Need Help!"

Hey folks,

I'm kinda stuck here. Trying to figure out if it's possible to pull CURL GET info from POST request. Like, I know GET and POST are different, but is there a hack or workaround?

Maybe something in the headers or response? Or am I just wasting my time?

Anybody run into this before? Would love some tips or even a "nah, not possible" so I can move on lol.

Thanks in advance!

---

OR

---

"Best Way to Extract CURL GET info from POST Request – Any Tips?"

Yo,

Quick question: what’s the best way to grab CURL GET info from POST request?

I’ve got a script where the endpoint expects POST, but I need to snag some GET-style params. Weird, right?

Tried digging into `$_SERVER` and headers, but no luck yet. Am I missing something obvious?

Appreciate any pointers! Cheers.

---

OR

---

"Is There a Method to Get CURL GET info from POST Request?"

Sup everyone,

Stumbled on a weird scenario—need to extract CURL GET info from POST request. Sounds contradictory, but maybe there’s a trick?

Checked docs and SO, but everything’s either GET *or* POST. Can they mix?

If you’ve pulled this off, hit me up! Even a "don’t bother" would save me hours haha.

Thanks!
Hey! Yeah, this is a weird one. If you're trying to grab CURL GET info from POST request, you might wanna check the `$_SERVER['QUERY_STRING']` or `$_GET` superglobals—sometimes they still hold GET params even in a POST request.

Not sure if it’ll work for your case, but worth a shot!
Nah, not possible directly—GET and POST are separate beasts. But you could hack it by passing GET-style params in the POST body or headers and parsing them manually.

Kinda messy, but if you’re desperate, it’s an option.
Yo, had this exact issue last week! What worked for me was using `http_build_query()` to stuff GET params into the POST body.

Then on the server side, parse them back out. Not elegant, but gets the job done for CURL GET info from POST request shenanigans.
If you’re using PHP, peek into `$_SERVER['REQUEST_URI']`—sometimes the GET params linger there even with POST.

Otherwise, maybe restructure your endpoint to handle params more cleanly? Mixing GET and POST is asking for trouble lol.
Hmm, sounds like an XY problem. Why do you need CURL GET info from POST request? Maybe there’s a better way to design the API call?

But if you’re stuck, try logging the raw request with `curl_setopt($ch, CURLOPT_VERBOSE, true);`—might reveal hidden params.
Not sure about your exact setup, but some frameworks (like Laravel) let you access GET params even in POST routes via `request()->query()`.

Might be framework-specific, but worth checking if you’re using one!
Honestly, unless you’re dealing with legacy code, avoid this mess. Redesign the endpoint to use POST body or GET params, not both.

But if you’re stuck, `parse_str(file_get_contents('php://input'), $postData)` might help fish out params.

---

OP Reply:

Wow, thanks for all the replies! Didn’t expect so many ideas.

Tried the `$_SERVER['QUERY_STRING']` trick and it kinda worked—found some stray GET params hiding there. Still feels janky though.

Might just refactor the endpoint like a few of you suggested. Appreciate the sanity check!

Quick follow-up: anyone know if this "CURL GET info from POST request" hack breaks with HTTPS or custom headers? Just wanna cover my bases.

Cheers!
Lol, been there. Try dumping `$_REQUEST`—it’s a combo of GET, POST, and COOKIE data.

Not the cleanest solution, but if you just need to extract CURL GET info from POST request real quick, it’s a dirty fix.
You could force it by appending GET params to the URL *and* sending a POST body.

Like: `curl -X POST "https://example.com?foo=bar" -d "post=data"`.

Weird, but servers often accept both.



Users browsing this thread: 1 Guest(s)