Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Your code don't convert Form Data to php #34

Open
HuyetCongTu opened this issue Nov 19, 2020 · 2 comments
Open

Your code don't convert Form Data to php #34

HuyetCongTu opened this issue Nov 19, 2020 · 2 comments

Comments

@HuyetCongTu
Copy link

Your code don't convert Form data to php

demo:

--data-raw "id=438^&novel=Going-Back-and-Forth-Between-Earth-and-The-Other-World-with-Space-Time-Magic^&max=430^&page=2" ^

@NabiKAZ
Copy link
Contributor

NabiKAZ commented Mar 6, 2021

Yep! I see a bug!

I have this:

curl 'https://example.com' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36' \
  --data-raw '{"min_name_length":10,"max_name_length":10}' \
  --compressed

Converted to this:

// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');

$headers = array();
$headers[] = 'Accept: application/json, text/plain, */*';
$headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

And didn't show data-raw.

@NabiKAZ
Copy link
Contributor

NabiKAZ commented Mar 6, 2021

Seem there are a pending pull request for this issue in here:
#35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants