SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New to API - So Confused

    I'm trying to use API to pull a lawyer search box from Avvo.com, a legal directory. The API page is http://api.avvo.com/docs/GET/lawyers/search.html.

    I'm new to API's and have no idea what to do. They give you a URL, example request, and example response, but I have no idea what to do with this.

    Can someone help me? Do I need to create a php file or something?

    Brandon

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,042
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    That is pretty straight forward. Rather than doing the work for you what specific part are you having a difficult time understanding? If it is how to make the request I would recommend starting at the cURL docs. From there going to json_decode. Not to question your integrity but it does bring up whether it might be better suited to pay someone than do it yourself. Asking questions like "do I need to create a php file or something" raises that concern.
    The only code I hate more than my own is everyone else's.

  3. #3
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    Asking questions like "do I need to create a php file or something" raises that concern.
    Yeah I felt a little dumb asking that, but I really had no idea where to start. From my research it seems as though I should start by creating a php file and defining a variable that uses "file_get_contents" to pull the data from the API URL. I'm familiar with file_get_contents.

    I got that far. After that, not sure what to do. I'll look into the links you sent. Thank you. If I do hire someone, I will hire them to train me because this is something I need to learn.

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,042
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    file_get_content should only be used to get the contents of files on the same server. When making remote requests cURL is more appropriate considering it has a timeout where file_get_contents will run until the max execution time is reached.
    The only code I hate more than my own is everyone else's.

  5. #5
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the heads up on cURL. I used that instead of file_get_contents.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •