Jump to content

Using cURL to get links on a page (not found in soure code)


Recommended Posts

Well this is a tricky one for me. The script I've created is able to upload images to a server. The server, which I have no control over, generates a random name. It uses Javascript and flash. As a result the links to these images are not within the source code.

 

I suppose the question is, is there a way to still grab these links? I'm familiar with cURL and I was thinking about using something like (CURLOPT_FOLLOWLOCATION) but I'm wondering if that would just look at the source code for links as well?

 

Has anyone had this problem before?

Yep, common problem.

 

Before writing a line of PHP you will want to find out EXACTLY how the links are being formed.  Whether they are being pulled in via an ajax call, hard coded in a JS file, etc.

 

If it's from an ajax call - you'll have to replicate that as well with CURL (remember, just because it's ajax doesn't make it special.  Can still send the same headers and (in theory) get the same response).

 

If it's hardcoded in javascript, you will need to pull down that file and parse it's contents.

 

It's a dirty job, but if it was easy everyone would be doin it! ;)

 

Thanks man. My head is spinning. I believe it's hard coded in Javascript. I'm going to try a few things and I'll post my 'success code', if I figure it out, here. In the mean time more suggestions are welcome.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.