1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Curl problem

Discussion in 'PHP' started by Fracisc, Oct 1, 2016.

  1. #1
    I have this:

    curl -H "Content-Type: application/json" -X POST -d '{"user":{"email":"mail@example.com","password":"secret"}}' -i https://url.com
    PHP:
    Mandatory header for any request is Content-Type: application/json.


    I need to use simple php code instead of command line. How can I do that?
     
    Fracisc, Oct 1, 2016 IP
  2. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #2
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'SOME HEADER',
        'APPTYPE:JSON'
        ));
    PHP:
    Just use curl_setopt
     
    Einheijar, Oct 2, 2016 IP