Created
November 9, 2011 12:37
-
-
Save fasmide/1351313 to your computer and use it in GitHub Desktop.
Simpel kommunikation med DBA's api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class DBA { | |
/** | |
example params: | |
'q' => 'yamaha mixer', | |
'ps' => 20, | |
'pn' => 1, | |
'f' => 'json', | |
'filters' => 1 | |
*/ | |
public static function search($params) | |
{ | |
$query = http_build_query($params); | |
$ch = curl_init('http://api.dba.dk/public/v1/ads?'.$query); | |
curl_setopt_array($ch, array( | |
CURLOPT_USERAGENT => 'Mozilla/5.0 (Linux; U; Android 2.2.1; en-US; X2 Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 (Agoraphobia)', | |
CURLOPT_RETURNTRANSFER => true | |
)); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
return json_decode($response); | |
} | |
} | |
echo json_encode(DBA::search(array( | |
'q' => "galaxy s wifi", | |
'ps' => 20, | |
'pn' => 1, | |
'f' => 'json', | |
'filters' => 1 | |
))); |
Author
fasmide
commented
Sep 11, 2019
via email
I have no idea I haven't maintained the code for ages :)
Vh kristian
…On Wed, Sep 11, 2019, 17:50 Gustav Jensen ***@***.***> wrote:
Does this still work? It just hangs for me when I try to access any
address on api.dba.dk, even when supplying android/iPhone useragents
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/1351313?email_source=notifications&email_token=AAJDXOMO3EAJHTXSBIOFNK3QJEHWBA5CNFSM4IVVZJSKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFYTBG#gistcomment-3024403>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJDXOOPIPVR2PGQEEISVULQJEHWBANCNFSM4IVVZJSA>
.
Looks a bit more advanced now
@lmunck, dbaplatform is a different company :/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment