PHP + curl - A Simple example of how to use cURL

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024
  • #phpCurl #phpTutorial #developmentTutorial
    In this video, we take a look at a simple cURL example in php. CURL can be a valuable tool in your developers tool bag!
    Company Website: www.ideapro.com
    I have been writing software for 30+ years and enjoy working with new clients and teaching others how to develop.
    SEND BUSINESS CORRESPONDENCE TO:
    Idea Pro LLC or Joshua Herbison
    2901 E Greenway Rd. #54171
    Phoenix, AZ 85032
    In my tutorials, you will see me upload files to the server. To upload, I use Sublime Text 3 with SFTP by WBond. idp.bz/sftp
    WordPress Codex: idp.bz/wordpres...

Комментарии • 51

  • @jherbison
    @jherbison  3 года назад +16

    I use cURL a lot in development. Let me know here in the comments if you want me to expand on the example and even possibly build out a full API that can pull data from another site.

    • @pmakosyo
      @pmakosyo 3 года назад +2

      Yeah, why not. Go for it.

    • @jherbison
      @jherbison  3 года назад +2

      Cool! Thanks!

    • @jherbison
      @jherbison  3 года назад

      What do you need help with? You can email me at josh@ideapro.com

    • @mohanwijesena6272
      @mohanwijesena6272 2 года назад

      Are you able to show how to use a refresh_token once and main token is expired?

  • @nikolav6350
    @nikolav6350 3 года назад +5

    You are the king of PHP . Thanks for tutorials!

    • @jherbison
      @jherbison  3 года назад

      Ha! Thanks. Thanks for watching and commenting.

  • @JillRhoads
    @JillRhoads 2 года назад +2

    This was EXACTLY what I was looking for. Thanks for putting in json with it as well and keeping it as simple as possible. Now I can do my REST API calls without bothering the external API server the whole time.

  • @oshinsaginian
    @oshinsaginian Год назад +1

    Thank you Joshua so much for your explicit [ detailed ] explanation - Love to watch your videos and learn.

    • @jherbison
      @jherbison  Год назад

      Awesome.. Thank you for watching and commenting.

  • @elkhanhamet2561
    @elkhanhamet2561 2 года назад +1

    thank you very much sir. I couldn’t grasp the true essence of cURL until I watched your tutorial. Great video!!!😊👏👏👏

  • @oliver1121
    @oliver1121 2 года назад

    Thank you for mentioning that there are curl builders out there! Twillio only gives curl examples on their examples and I found a curl to php website that has done all the hard work for me :D

  • @sebastiannieroda9022
    @sebastiannieroda9022 3 года назад +1

    Of course we are waiting for the expand of this topic

    • @jherbison
      @jherbison  3 года назад

      Cool. I will work on that video. Thanks for watching and commenting.

  • @olamideoshiyokun7317
    @olamideoshiyokun7317 Месяц назад

    I love this so much...... thanks Josh

  • @JerrySmith-nq9mj
    @JerrySmith-nq9mj 3 года назад +1

    Thanks for this Joshua. If you ever get a chance I'd like to see a tutorial on the POST method for cURL. Basically filling out a form and then sending that data using cURL and a JSON File.

    • @jherbison
      @jherbison  3 года назад

      Ok, I will add that to the list and do that video next.. Possibly today or the next couple of days. Thank you for watching and commenting.

  • @adventuretime6457
    @adventuretime6457 2 года назад

    best video regarding curl php

  • @judeleon8485
    @judeleon8485 Месяц назад

    Well explained topic. However, it appears like this is the only topic on cURL. If there are others, please point me to them. Thanks

  • @Daud181
    @Daud181 3 года назад +2

    Great video sir we need more interesting video

    • @jherbison
      @jherbison  3 года назад +1

      Like what? Thanks for watching and commenting.

    • @Daud181
      @Daud181 3 года назад

      @@jherbison like how we make a simple preloader plugin CSV maker plugin print functionality and forms etc

  • @theman7050
    @theman7050 2 года назад +1

    Hello Joshua,
    You mentioned that you used cURL to track number of sold products from your client's site.
    So could you plz briefly mention the main points of the process? I mean, one could also put a plugin that would fire on every successful sale and contact an external API via POST method. But I guess cURL allows intrusion without login or inserting plugin as it can easily be deleted by client.
    What makes cURL ideal for this circumstance.
    Im still learning backend WP and finding your tutorials very VERY helpful. Dnt stop plz. :)
    Although a video on using cURL to track something like purchases on a client site would be great ✌🏼🙂

    • @jherbison
      @jherbison  2 года назад +1

      Sorry for the delay in responding.. I just released a video that addresses your question... Kind of!!!! I will address the Curl on another video this week.
      ruclips.net/video/V_My277URS8/видео.html

    • @theman7050
      @theman7050 2 года назад

      @@jherbison Thank you soo much mate :D

  • @dfrontierit2114
    @dfrontierit2114 2 года назад

    Thank you this helped in one of my projects

  • @phoneyiam123
    @phoneyiam123 3 года назад +1

    Would love to see a vid on using cURL in wordpress to hide API keys. I'm using leaflet map and need an API key in my markers url and I can't figure out how to hide it.

    • @jherbison
      @jherbison  3 года назад +1

      Not sure I completely understand. Who are you trying to hide the API keys from? If it is PHP with Curl, the only people that could see the API key is anyone that has access to the code. PHP code isn't viewing to the public.

    • @phoneyiam123
      @phoneyiam123 3 года назад +1

      @@jherbison Sorry for the vague comment. I have a real estate website that is pulling listings from a json url and displaying those listings on a map. This is done via javascript so all the code is visible in the source and that includes the url to the json file which contains an API key.
      I was told I needed to use cURL to hide the key and then call to it via a variable in my javascript code. I'm a bit of a novice so I'm pretty lost.

    • @jherbison
      @jherbison  3 года назад +1

      Oh ok, can you email me more details at josh@ideapro.com?

    • @phoneyiam123
      @phoneyiam123 3 года назад

      @@jherbison Sending you an email now!

    • @jherbison
      @jherbison  3 года назад

      I replied to your email. Did you get it?

  • @andikprasetyo4049
    @andikprasetyo4049 8 месяцев назад

    sorry sir, I get this error when trying to access external API: OpenSSL SSL_connect: Connection reset by peer in connection to blablabla, how do i fix it?

  • @Daud181
    @Daud181 3 года назад +2

    Sir now a days I am working on WordPress back up site plugin. Can you please make a video on back up plugin that how we easy create backup site plugin.

    • @jherbison
      @jherbison  3 года назад +1

      So you want me to make the plugin for you? ;-). What do you want to do different than the other plug-ins out there don’t do?

    • @Daud181
      @Daud181 3 года назад +1

      @@jherbison Yes sir there is multiple plugins are available for backup a wordpress site but I have to learn plugin developement so my task to create a backup plugin for WordPress
      I have confuse how to do this
      I have multiple options
      Like if a use only databases file then the images and assets folder will not Work how I download both things
      Database and wordpress file like All in one migration plugin.
      Can you please tell some major function or topic related to this

    • @jherbison
      @jherbison  3 года назад +1

      That is a big plugin to learn on!

    • @Daud181
      @Daud181 3 года назад +1

      @@jherbison yes sir I know but I have to done this

    • @jherbison
      @jherbison  3 года назад +2

      Cool. Good luck.

  • @adventuretime6457
    @adventuretime6457 2 года назад

    I want to use post curl api which has been given by vendor, how can I call that in my code?

  • @virajsingh553
    @virajsingh553 3 года назад +1

    My curl_exec is returning false . Can you tell me how to get my desired json file

    • @jherbison
      @jherbison  3 года назад

      Thank you for watching and commenting.. Send me an email with your code to josh@ideapro.com you may just need to add a couple of lines in the curl to turn off verify host.
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  • @Daud181
    @Daud181 3 года назад +2

    Sir how we make Medicine bill price calculator in WordPress with code

    • @jherbison
      @jherbison  3 года назад

      Please explain more of what you are looking for.

    • @Daud181
      @Daud181 3 года назад +1

      @@jherbison sir recently I have done project hospital managnment system on WordPress but my client ask me please Make a form which do calacultion of purchase medicine
      Example
      If a user buy one tablet form pharmacy so the system calculate the Medicane price calculation with discount and give total amount with print slip functionality one user done they get slip of her purchase record
      And print slip record have name of hospital and address phone and note form hospital which is permant and default print on every slip

  • @gagarin-d
    @gagarin-d 2 года назад +1

    Спасибо за видео

    • @jherbison
      @jherbison  2 года назад

      Пожалуйста. Спасибо за просмотр и комментарий.

  • @vishvish24
    @vishvish24 2 года назад

    How to fetch api data every second without setInterval as setinterval is just single threaded and not proper solution for this